Skip to content

Commit a08634a

Browse files
committed
fix unit test
1 parent 3bb3a87 commit a08634a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

protocol-designer/src/file-data/__tests__/createFile.test.ts

+14-6
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,12 @@ describe('createFile selector', () => {
7070
afterEach(() => {
7171
vi.restoreAllMocks()
7272
})
73+
const entities = {
74+
moduleEntities: v7Fixture.moduleEntities,
75+
labwareEntities,
76+
pipetteEntities,
77+
liquidEntities: ingredients,
78+
}
7379
it('should return a schema-valid JSON V8 protocol', () => {
7480
// @ts-expect-error(sa, 2021-6-15): resultFunc not part of Selector type
7581
const result = createFile.resultFunc(
@@ -78,16 +84,13 @@ describe('createFile selector', () => {
7884
v7Fixture.robotStateTimeline,
7985
OT2_ROBOT_TYPE,
8086
dismissedWarnings,
81-
ingredients,
8287
ingredLocations,
8388
v7Fixture.savedStepForms,
8489
v7Fixture.orderedStepIds,
85-
labwareEntities,
86-
v7Fixture.moduleEntities,
87-
pipetteEntities,
8890
labwareNicknamesById,
8991
labwareDefsByURI,
90-
{}
92+
{},
93+
entities
9194
)
9295
expectResultToMatchSchema(result)
9396

@@ -99,7 +102,12 @@ describe('createFile selector', () => {
99102

100103
it('should return a valid Python protocol file', () => {
101104
// @ts-expect-error(sa, 2021-6-15): resultFunc not part of Selector type
102-
const result = createPythonFile.resultFunc(fileMetadata, OT2_ROBOT_TYPE, {})
105+
const result = createPythonFile.resultFunc(
106+
fileMetadata,
107+
OT2_ROBOT_TYPE,
108+
entities,
109+
v7Fixture.initialRobotState
110+
)
103111
// This is just a quick smoke test to make sure createPythonFile() produces
104112
// something that looks like a Python file. The individual sections of the
105113
// generated Python will be tested in separate unit tests.

protocol-designer/src/file-data/selectors/pythonFile.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ export function pythonDefRun(
7676
invariantContext: InvariantContext,
7777
robotState: TimelineFrame
7878
): string {
79-
const loadModules = getLoadModules(
80-
invariantContext.moduleEntities,
81-
robotState.modules
82-
)
79+
const { moduleEntities } = invariantContext
80+
81+
const loadModules = getLoadModules(moduleEntities, robotState.modules)
82+
8383
const sections: string[] = [
8484
...loadModules,
8585
// loadLabware(),

0 commit comments

Comments
 (0)