-
Notifications
You must be signed in to change notification settings - Fork 187
refactor(step-generation, shared-data): use set_stored_labware_items and fill_items #20293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: edge
Are you sure you want to change the base?
Changes from 3 commits
ec1148c
d9202ee
dcf39d3
b415afd
3016590
4ebfc7a
ee0ffa3
af989af
ccba87b
2cf4e98
fc6bb8e
a8a3e8f
41ad469
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,129 @@ | ||
| import { beforeEach, describe, expect, it, vi } from 'vitest' | ||
|
|
||
| import { | ||
|
Check failure on line 3 in step-generation/src/__tests__/flexStackerFillItems.test.ts
|
||
| fixture96Plate, | ||
| FLEX_STACKER_MODULE_TYPE, | ||
| FLEX_STACKER_MODULE_V1, | ||
| LabwareDefinition2, | ||
| } from '@opentrons/shared-data' | ||
|
|
||
| import { flexStackerFillItems } from '../commandCreators/atomic/flexStackerFillItems' | ||
| import { getInitialRobotStateStandard, makeContext } from '../fixtures' | ||
|
|
||
| import type { InvariantContext, RobotState } from '../types' | ||
|
|
||
| const moduleId = 'flexStackerId' | ||
| const labwareId = 'labwareId' | ||
| const labwareId2 = 'labwareId2' | ||
| const labwareId3 = 'labwareId3' | ||
| const labwareId4 = 'labwareId4' | ||
| const labwareId5 = 'labwareId5' | ||
| vi.mock('../robotStateSelectors') | ||
|
|
||
| describe('flexStackerFillItems', () => { | ||
| let invariantContext: InvariantContext | ||
| let robotState: RobotState | ||
| beforeEach(() => { | ||
| invariantContext = makeContext() | ||
| robotState = getInitialRobotStateStandard(invariantContext) | ||
| invariantContext.moduleEntities[moduleId] = { | ||
| id: moduleId, | ||
| type: FLEX_STACKER_MODULE_TYPE, | ||
| model: FLEX_STACKER_MODULE_V1, | ||
| pythonName: 'mock_flex_stacker_1', | ||
| } | ||
| invariantContext.labwareEntities = { | ||
| [labwareId]: { | ||
| id: labwareId, | ||
| def: fixture96Plate as LabwareDefinition2, | ||
| labwareDefURI: 'mockURI', | ||
| pythonName: 'mock_labware_1', | ||
| }, | ||
| [labwareId2]: { | ||
| id: labwareId2, | ||
| def: fixture96Plate as LabwareDefinition2, | ||
| labwareDefURI: 'mockURI', | ||
| pythonName: 'mock_labware_2', | ||
| }, | ||
| [labwareId3]: { | ||
| id: labwareId3, | ||
| def: fixture96Plate as LabwareDefinition2, | ||
| labwareDefURI: 'mockURI', | ||
| pythonName: 'mock_labware_3', | ||
| }, | ||
| [labwareId4]: { | ||
| id: labwareId4, | ||
| def: fixture96Plate as LabwareDefinition2, | ||
| labwareDefURI: 'mockURI', | ||
| pythonName: 'mock_labware_4', | ||
| }, | ||
| [labwareId5]: { | ||
| id: labwareId5, | ||
| def: fixture96Plate as LabwareDefinition2, | ||
| labwareDefURI: 'mockURI', | ||
| pythonName: 'mock_labware_5', | ||
| }, | ||
| } | ||
| }) | ||
| it('creates flex stacker fill command with 1 labware', () => { | ||
| const result = flexStackerFillItems( | ||
| { | ||
| moduleId, | ||
| labware: [labwareId], | ||
| }, | ||
| invariantContext, | ||
| robotState | ||
| ) | ||
| expect(result).toEqual({ | ||
| commands: [ | ||
| { | ||
| commandType: 'flexStacker/fillItems', | ||
| key: expect.any(String), | ||
| params: { | ||
| moduleId, | ||
| labware: [labwareId], | ||
| }, | ||
| }, | ||
| ], | ||
| python: ` | ||
| mock_flex_stacker_1.fill_items( | ||
| labware=[mock_labware_1], | ||
| )`.trimStart(), | ||
| }) | ||
| }) | ||
| it('creates flex stacker fill command with 5 labware', () => { | ||
| const result = flexStackerFillItems( | ||
| { | ||
| moduleId, | ||
| labware: [labwareId, labwareId2, labwareId3, labwareId4, labwareId5], | ||
| }, | ||
| invariantContext, | ||
| robotState | ||
| ) | ||
| expect(result).toEqual({ | ||
| commands: [ | ||
| { | ||
| commandType: 'flexStacker/fillItems', | ||
| key: expect.any(String), | ||
| params: { | ||
| moduleId, | ||
| labware: [ | ||
| labwareId, | ||
| labwareId2, | ||
| labwareId3, | ||
| labwareId4, | ||
| labwareId5, | ||
| ], | ||
| }, | ||
| }, | ||
| ], | ||
| python: ` | ||
| mock_flex_stacker_1.fill_items( | ||
| labware=[ | ||
| mock_labware_1, mock_labware_2, mock_labware_3, mock_labware_4, | ||
| mock_labware_5 | ||
| ], | ||
| )`.trimStart(), | ||
| }) | ||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -99,7 +99,7 @@ describe('flexStackerRetrieve', () => { | |
| }, | ||
| }, | ||
| ], | ||
| python: 'wellPlate_1 = mock_flex_stacker_1.retrieve()', | ||
| python: 'mock_flex_stacker_1.retrieve()', | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks! |
||
| }) | ||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,6 +20,7 @@ import { | |
| WATER_LIQUID_CLASS_NAME, | ||
| } from '@opentrons/shared-data' | ||
|
|
||
| import { HOPPER_STACKER_LOCATION } from '../constants' | ||
| import { | ||
| formatChangeTipArg, | ||
| formatPyStr, | ||
|
|
@@ -440,7 +441,6 @@ well_plate_3 = protocol.load_labware_from_definition( | |
| }, | ||
| } | ||
| const mockLabwareEntitiesWithFlexStackerLabware = { | ||
| ...mockLabwareEntities, | ||
| [flexStackerLabwareId]: { | ||
| id: flexStackerLabwareId, | ||
| labwareDefURI: 'opentrons/fixture_96_plate/1', | ||
|
|
@@ -450,10 +450,8 @@ well_plate_3 = protocol.load_labware_from_definition( | |
| } | ||
|
|
||
| const mockLabwareRobotStateWithFlexStackerLabware = { | ||
| ...labwareRobotState, | ||
| [flexStackerLabwareId]: { | ||
| ...labwareRobotState[labwareId6], | ||
| stack: [flexStackerLabwareId, moduleId4, 'A4'], | ||
| stack: [flexStackerLabwareId, HOPPER_STACKER_LOCATION, moduleId4, 'A4'], | ||
| }, | ||
| } | ||
|
|
||
|
|
@@ -465,11 +463,9 @@ well_plate_3 = protocol.load_labware_from_definition( | |
|
|
||
| expect(setStoredLabware).toBe( | ||
| `# Set Stored Labware: | ||
| flex_stacker_1 = protocol.set_stored_labware( | ||
| loadName="fixture_96_plate", | ||
| namespace="opentrons", | ||
| version=1, | ||
| count=1)`.trimStart() | ||
| flex_stacker_1 = protocol.set_stored_labware_list( | ||
| labware=[well_plate_4], | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Out of curiosity: Is the PD UI not going to ask the user for a string so that the user has something to look at when the ODD prompts them to fill the hopper? (The
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooooh this is an option, yes. i'll add the message arg |
||
| )`.trimStart() | ||
| ) | ||
| }) | ||
| }) | ||
|
|
||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.