Skip to content

Commit 3e09342

Browse files
committed
getVisualSlotIdFromAAId
1 parent 1f769c3 commit 3e09342

File tree

4 files changed

+244
-118
lines changed

4 files changed

+244
-118
lines changed

app/src/organisms/DeviceDetailsDeckConfiguration/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ import {
2727
getAAByAAId,
2828
getAAComboFixtureDisplayName,
2929
getAASlotDisplayName,
30-
getAASlotIdForAA,
3130
getCutoutDisplayName,
3231
getDeckDefFromRobotType,
3332
getFixtureDisplayName,
33+
getVisualSlotIdForAA,
3434
replaceFixtureToFakeFixtureAndTransformCutoutFixturesToAA,
3535
SINGLE_SLOT_FIXTURES,
3636
} from '@opentrons/shared-data'
@@ -158,7 +158,7 @@ export function DeviceDetailsDeckConfiguration({
158158
}
159159
}
160160
}
161-
const name = getAASlotIdForAA(
161+
const name = getVisualSlotIdForAA(
162162
cutoutId,
163163
cutoutFixtureId,
164164
addressableAreaId

app/src/organisms/DeviceDetailsDeckConfiguration/utils.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
DEFAULT_AA_FOR_WASTE_CHUTE,
3+
getAAsToFixtureIdFromDeckDefWithFakes,
34
getDeckDefFromRobotType,
4-
getFlexDeckDefAAByFixtureIdForCutoutId,
55
MAGNETIC_BLOCK_V1_FIXTURE,
66
MODULE_FIXTURES_BY_MODEL,
77
replaceAAWithFakeAA,
@@ -66,7 +66,7 @@ export const getModuleUnconfiguredFixtures = (
6666
moduleModel: ModuleModel,
6767
addressableAreaId: AddressableAreaNamesWithFakes
6868
): CutoutConfigMap[][] => {
69-
const addressableAreasById = getFlexDeckDefAAByFixtureIdForCutoutId(cutoutId)
69+
const addressableAreasById = getAAsToFixtureIdFromDeckDefWithFakes(cutoutId)
7070
const filteredMods = getFilteredModules(unconfiguredMods, moduleModel)
7171

7272
return filteredMods
@@ -247,7 +247,7 @@ export const getOptions = (
247247
): CutoutConfigMap[][] => {
248248
if (providedFixtureOptions != null) {
249249
return providedFixtureOptions?.map((o: CutoutFixtureId) => {
250-
const addressableAreasById = getFlexDeckDefAAByFixtureIdForCutoutId(
250+
const addressableAreasById = getAAsToFixtureIdFromDeckDefWithFakes(
251251
cutoutId
252252
)
253253
const aaProvidedFixtureOptions = addressableAreasById[o]

shared-data/js/__tests__/fixtures.test.ts

Lines changed: 37 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ import {
2020
} from '..'
2121
import {
2222
getAAComboFixtureDisplayName,
23-
getAASlotIdForAA,
23+
getAAsToFixtureIdFromDeckDefWithFakes,
2424
getAAWithFakesFromCutoutFixtureId,
2525
getCutoutFixtureReplacementIfNeeded,
26-
getFlexDeckDefAAByFixtureIdForCutoutId,
2726
getReplacementFixtureForFakeFixture,
2827
getReplacementFixtureForFixtureRemoval,
28+
getVisualSlotIdForAA,
2929
getVisualSlotIdFromAAId,
3030
isFixtureInUsbModules,
3131
replaceAAWithFakeAA,
@@ -40,12 +40,14 @@ vi.mock('react-i18next', () => ({
4040
useTranslation: vi.fn(),
4141
}))
4242

43+
const deckDef = getDeckDefFromRobotType('OT-3 Standard')
44+
4345
describe('getAAFromCutoutFixtureId', () => {
4446
it('Should get the aa for a cutoutId and a cutoutFixtureId', () => {
4547
const result = getAAWithFakesFromCutoutFixtureId(
4648
'cutoutD3',
4749
'flexStackerModuleV1',
48-
getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
50+
deckDef
4951
)
5052

5153
const expectedOrder = ['flexStackerModuleV1D4', 'D3']
@@ -56,7 +58,7 @@ describe('getAAFromCutoutFixtureId', () => {
5658
const result = getAAWithFakesFromCutoutFixtureId(
5759
'cutoutA1',
5860
'flexStackerModuleV1',
59-
getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
61+
deckDef
6062
)
6163

6264
expect(result).toBeUndefined()
@@ -194,7 +196,7 @@ describe('getCutoutFixtureReplacementIfNeeded', () => {
194196
const result = getCutoutFixtureReplacementIfNeeded(
195197
SINGLE_RIGHT_SLOT_FIXTURE,
196198
'cutoutA3',
197-
getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
199+
deckDef
198200
)
199201

200202
expect(result).toEqual(FAKE_STAGING_AREA_RIGHT_SLOT)
@@ -204,7 +206,7 @@ describe('getCutoutFixtureReplacementIfNeeded', () => {
204206
const result = getCutoutFixtureReplacementIfNeeded(
205207
STAGING_AREA_RIGHT_SLOT_FIXTURE,
206208
'cutoutB3',
207-
getDeckDefFromRobotType(FLEX_ROBOT_TYPE)
209+
deckDef
208210
)
209211

210212
expect(result).toEqual(STAGING_AREA_RIGHT_SLOT_FIXTURE)
@@ -275,7 +277,10 @@ describe('getReplacementFixtureForFixtureRemoval', () => {
275277

276278
describe('getFlexDeckDefAAByFixtureIdForCutoutId', () => {
277279
it('Should return a dic of fixtures and aa for cutoutA3', () => {
278-
const cutoutA3Result = getFlexDeckDefAAByFixtureIdForCutoutId('cutoutA3')
280+
const cutoutA3Result = getAAsToFixtureIdFromDeckDefWithFakes(
281+
'cutoutA3',
282+
deckDef
283+
)
279284

280285
expect(cutoutA3Result).toEqual({
281286
singleRightSlot: ['A3'],
@@ -300,14 +305,18 @@ describe('getFlexDeckDefAAByFixtureIdForCutoutId', () => {
300305
})
301306

302307
it('Should return a dic of fixtures and aa for cutoutD3', () => {
303-
const cutoutD3Result = getFlexDeckDefAAByFixtureIdForCutoutId('cutoutD3')
308+
const cutoutD3Result = getAAsToFixtureIdFromDeckDefWithFakes(
309+
'cutoutD3',
310+
deckDef
311+
)
312+
console.log('cutoutD3Result: ', cutoutD3Result)
304313
expect(cutoutD3Result).toEqual({
305314
absorbanceReaderV1: [
306315
'absorbanceReaderV1D3',
307316
'absorbanceReaderV1LidDockD4',
308317
],
309318
fakeStagingAreaRightSlot: ['D3', 'fakeD4'],
310-
fakeStagingSlotWithMagBlockV1: ['fakeD4', 'magneticBlockV1D3'],
319+
fakeStagingSlotWithMagBlockV1: ['magneticBlockV1D3', 'fakeD4'],
311320
fakeWasteChuteWithEmptySlot: ['96ChannelWasteChute', 'fakeD4'],
312321
flexStackerModuleV1: ['D3', 'flexStackerModuleV1D4'],
313322
flexStackerModuleV1WithMagneticBlockV1: [
@@ -358,7 +367,10 @@ describe('getFlexDeckDefAAByFixtureIdForCutoutId', () => {
358367
})
359368
})
360369
it('Should return a dic of fixtures and aa for cutoutA1', () => {
361-
const cutoutA1Result = getFlexDeckDefAAByFixtureIdForCutoutId('cutoutA1')
370+
const cutoutA1Result = getAAsToFixtureIdFromDeckDefWithFakes(
371+
'cutoutA1',
372+
deckDef
373+
)
362374
expect(cutoutA1Result).toEqual({
363375
singleLeftSlot: ['A1'],
364376
trashBinAdapter: ['movableTrashA1'],
@@ -393,32 +405,32 @@ describe('getReplacementFixtureForFakeFixture', () => {
393405
})
394406
})
395407

396-
describe('getAASlotNameForAA', () => {
397-
it('should get aa name for single right slot', () => {
398-
const result = getAASlotIdForAA(
408+
describe('getVisualSlotIdForAA', () => {
409+
it('should get vs name for single right slot', () => {
410+
const result = getVisualSlotIdForAA(
399411
'cutoutA3',
400412
FAKE_STAGING_SLOT_WITH_MAG_BLOCK,
401413
'magneticBlockV1A3'
402414
)
403-
expect(result).toEqual('A3')
415+
expect(result).toEqual('VSA3')
404416
})
405417

406-
it('should return aa name for single center slot', () => {
407-
const result = getAASlotIdForAA(
418+
it('should return vs name for single center slot', () => {
419+
const result = getVisualSlotIdForAA(
408420
'cutoutD1',
409421
TEMPERATURE_MODULE_V2_FIXTURE,
410422
'temperatureModuleV2D1'
411423
)
412-
expect(result).toEqual('D1')
424+
expect(result).toEqual('VSD1')
413425
})
414426

415-
it('should get input aa name for single center slot', () => {
416-
const result = getAASlotIdForAA(
427+
it('should get vs id for mag block in D2', () => {
428+
const result = getVisualSlotIdForAA(
417429
'cutoutD2',
418430
MAGNETIC_BLOCK_V1_FIXTURE,
419431
'magneticBlockV1D2'
420432
)
421-
expect(result).toEqual('D2')
433+
expect(result).toEqual('VSD2')
422434
})
423435
})
424436

@@ -461,7 +473,7 @@ describe('getAAFixtureDisplayName', () => {
461473
const name = getAAComboFixtureDisplayName(
462474
FLEX_STACKER_WTIH_WASTE_CHUTE_ADAPTER_NO_COVER_FIXTURE,
463475
'flexStackerModuleV1D4',
464-
getDeckDefFromRobotType('OT-3 Standard'),
476+
deckDef,
465477
t,
466478
''
467479
)
@@ -472,7 +484,7 @@ describe('getAAFixtureDisplayName', () => {
472484
const name = getAAComboFixtureDisplayName(
473485
FLEX_STACKER_WITH_MAG_BLOCK_FIXTURE,
474486
'magneticBlockV1D3',
475-
getDeckDefFromRobotType('OT-3 Standard'),
487+
deckDef,
476488
t,
477489
'deck_configuration'
478490
)
@@ -483,7 +495,7 @@ describe('getAAFixtureDisplayName', () => {
483495
const name = getAAComboFixtureDisplayName(
484496
FLEX_STACKER_WITH_MAG_BLOCK_FIXTURE,
485497
'magneticBlockV1D3',
486-
getDeckDefFromRobotType('OT-3 Standard'),
498+
deckDef,
487499
t,
488500
'deck_configuration'
489501
)
@@ -494,7 +506,7 @@ describe('getAAFixtureDisplayName', () => {
494506
const name = getAAComboFixtureDisplayName(
495507
FAKE_WASTE_CHUTE_WITH_EMPTY_SLOT,
496508
'96ChannelWasteChute',
497-
getDeckDefFromRobotType('OT-3 Standard'),
509+
deckDef,
498510
t,
499511
'deck_configuration'
500512
)
@@ -505,7 +517,7 @@ describe('getAAFixtureDisplayName', () => {
505517
const name = getAAComboFixtureDisplayName(
506518
MAGNETIC_BLOCK_V1_FIXTURE,
507519
'magneticBlockV1D3',
508-
getDeckDefFromRobotType('OT-3 Standard'),
520+
deckDef,
509521
t,
510522
'deck_configuration'
511523
)

0 commit comments

Comments
 (0)