-
Notifications
You must be signed in to change notification settings - Fork 179
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(app, api-client): add utilities for parsing deck config via …
…addressable areas (#13947) Instead of explicit load fixture commands, extrapolate the simplest possible setup for the deck given the included addressable areas referenced in a set of protocol commands Closes RAUT-853
- Loading branch information
Showing
22 changed files
with
591 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
142 changes: 142 additions & 0 deletions
142
app/src/resources/deck_configuration/__tests__/utils.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,142 @@ | ||
import { RunTimeCommand } from '@opentrons/shared-data' | ||
import { | ||
FLEX_SIMPLEST_DECK_CONFIG, | ||
getSimplestDeckConfigForProtocolCommands, | ||
} from '../utils' | ||
|
||
const RUN_TIME_COMMAND_STUB_MIXIN: Pick< | ||
RunTimeCommand, | ||
'id' | 'createdAt' | 'startedAt' | 'completedAt' | 'status' | ||
> = { | ||
id: 'fake_id', | ||
createdAt: 'fake_createdAt', | ||
startedAt: 'fake_startedAt', | ||
completedAt: 'fake_createdAt', | ||
status: 'succeeded', | ||
} | ||
|
||
describe('getSimplestDeckConfigForProtocolCommands', () => { | ||
it('returns simplest deck if no commands alter addressable areas', () => { | ||
expect(getSimplestDeckConfigForProtocolCommands([])).toEqual( | ||
FLEX_SIMPLEST_DECK_CONFIG | ||
) | ||
}) | ||
it('returns staging area fixtures if commands address column 4 areas', () => { | ||
const cutoutConfigs = getSimplestDeckConfigForProtocolCommands([ | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'loadLabware', | ||
params: { | ||
loadName: 'fake_load_name', | ||
location: { slotName: 'A4' }, | ||
version: 1, | ||
namespace: 'fake_namespace', | ||
}, | ||
}, | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'loadLabware', | ||
params: { | ||
loadName: 'fake_load_name', | ||
location: { slotName: 'B4' }, | ||
version: 1, | ||
namespace: 'fake_namespace', | ||
}, | ||
}, | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'loadLabware', | ||
params: { | ||
loadName: 'fake_load_name', | ||
location: { slotName: 'C4' }, | ||
version: 1, | ||
namespace: 'fake_namespace', | ||
}, | ||
}, | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'loadLabware', | ||
params: { | ||
loadName: 'fake_load_name', | ||
location: { slotName: 'D4' }, | ||
version: 1, | ||
namespace: 'fake_namespace', | ||
}, | ||
}, | ||
]) | ||
expect(cutoutConfigs).toEqual([ | ||
...FLEX_SIMPLEST_DECK_CONFIG.slice(0, 8), | ||
{ | ||
cutoutId: 'cutoutA3', | ||
cutoutFixtureId: 'stagingAreaRightSlot', | ||
requiredAddressableAreas: ['A4'], | ||
}, | ||
{ | ||
cutoutId: 'cutoutB3', | ||
cutoutFixtureId: 'stagingAreaRightSlot', | ||
requiredAddressableAreas: ['B4'], | ||
}, | ||
{ | ||
cutoutId: 'cutoutC3', | ||
cutoutFixtureId: 'stagingAreaRightSlot', | ||
requiredAddressableAreas: ['C4'], | ||
}, | ||
{ | ||
cutoutId: 'cutoutD3', | ||
cutoutFixtureId: 'stagingAreaRightSlot', | ||
requiredAddressableAreas: ['D4'], | ||
}, | ||
]) | ||
}) | ||
it('returns simplest cutout fixture where many are possible', () => { | ||
const cutoutConfigs = getSimplestDeckConfigForProtocolCommands([ | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'moveLabware', | ||
params: { | ||
newLocation: { addressableAreaName: 'gripperWasteChute' }, | ||
labwareId: 'fake_labwareId', | ||
strategy: 'usingGripper', | ||
}, | ||
}, | ||
]) | ||
expect(cutoutConfigs).toEqual([ | ||
...FLEX_SIMPLEST_DECK_CONFIG.slice(0, 11), | ||
{ | ||
cutoutId: 'cutoutD3', | ||
cutoutFixtureId: 'wasteChuteRightAdapterNoCover', | ||
requiredAddressableAreas: ['gripperWasteChute'], | ||
}, | ||
]) | ||
}) | ||
it('returns compatible cutout fixture where multiple addressable requirements present', () => { | ||
const cutoutConfigs = getSimplestDeckConfigForProtocolCommands([ | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'moveLabware', | ||
params: { | ||
newLocation: { addressableAreaName: 'gripperWasteChute' }, | ||
labwareId: 'fake_labwareId', | ||
strategy: 'usingGripper', | ||
}, | ||
}, | ||
{ | ||
...RUN_TIME_COMMAND_STUB_MIXIN, | ||
commandType: 'moveLabware', | ||
params: { | ||
newLocation: { addressableAreaName: 'D4' }, | ||
labwareId: 'fake_labwareId', | ||
strategy: 'usingGripper', | ||
}, | ||
}, | ||
]) | ||
expect(cutoutConfigs).toEqual([ | ||
...FLEX_SIMPLEST_DECK_CONFIG.slice(0, 11), | ||
{ | ||
cutoutId: 'cutoutD3', | ||
cutoutFixtureId: 'stagingAreaSlotWithWasteChuteRightAdapterNoCover', | ||
requiredAddressableAreas: ['gripperWasteChute', 'D4'], | ||
}, | ||
]) | ||
}) | ||
}) |
Oops, something went wrong.