Skip to content

Commit 9d41c60

Browse files
authored
fix(step-generation): double labwares on a module (#17791)
fix RQA-4005
1 parent 6d01de1 commit 9d41c60

File tree

2 files changed

+39
-4
lines changed

2 files changed

+39
-4
lines changed

step-generation/src/__tests__/moveLabware.test.ts

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,43 @@ describe('moveLabware', () => {
322322
type: 'LABWARE_ON_ANOTHER_ENTITY',
323323
})
324324
})
325+
it('should return an error for trying to move the labware to an occupied module', () => {
326+
const state = getInitialRobotStateStandard(invariantContext)
327+
const HEATER_SHAKER_ID = 'heaterShakerId'
328+
const HEATER_SHAKER_SLOT = 'A1'
329+
330+
robotState = {
331+
...state,
332+
modules: {
333+
...state.modules,
334+
[HEATER_SHAKER_ID]: {
335+
slot: HEATER_SHAKER_SLOT,
336+
moduleState: {
337+
type: HEATERSHAKER_MODULE_TYPE,
338+
latchOpen: true,
339+
targetSpeed: null,
340+
},
341+
} as any,
342+
},
343+
labware: {
344+
...state.labware,
345+
mockLabwareId: {
346+
slot: HEATER_SHAKER_ID,
347+
},
348+
},
349+
}
350+
const params = {
351+
labwareId: SOURCE_LABWARE,
352+
strategy: 'usingGripper',
353+
newLocation: { moduleId: HEATER_SHAKER_ID },
354+
} as MoveLabwareParams
355+
356+
const result = moveLabware(params, invariantContext, robotState)
357+
expect(getErrorResult(result).errors).toHaveLength(1)
358+
expect(getErrorResult(result).errors[0]).toMatchObject({
359+
type: 'LABWARE_ON_ANOTHER_ENTITY',
360+
})
361+
})
325362
it('should return an error for the labware already being discarded in previous step', () => {
326363
const wasteChuteInvariantContext = {
327364
...invariantContext,

step-generation/src/commandCreators/atomic/moveLabware.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ export const moveLabware: CommandCreator<MoveLabwareParams> = (
7272
)
7373

7474
const newLocationSlot =
75-
newLocation !== 'offDeck' &&
76-
newLocation !== 'systemLocation' &&
77-
'slotName' in newLocation
78-
? newLocation.slotName
75+
newLocation !== 'offDeck' && newLocation !== 'systemLocation'
76+
? Object.values(newLocation)[0]
7977
: null
8078

8179
const multipleObjectsInSameSlotLabware =

0 commit comments

Comments
 (0)