Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
jerader committed Feb 10, 2025
1 parent 3bb3a87 commit a08634a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 10 deletions.
20 changes: 14 additions & 6 deletions protocol-designer/src/file-data/__tests__/createFile.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,12 @@ describe('createFile selector', () => {
afterEach(() => {
vi.restoreAllMocks()
})
const entities = {
moduleEntities: v7Fixture.moduleEntities,
labwareEntities,
pipetteEntities,
liquidEntities: ingredients,
}
it('should return a schema-valid JSON V8 protocol', () => {
// @ts-expect-error(sa, 2021-6-15): resultFunc not part of Selector type
const result = createFile.resultFunc(
Expand All @@ -78,16 +84,13 @@ describe('createFile selector', () => {
v7Fixture.robotStateTimeline,
OT2_ROBOT_TYPE,
dismissedWarnings,
ingredients,
ingredLocations,
v7Fixture.savedStepForms,
v7Fixture.orderedStepIds,
labwareEntities,
v7Fixture.moduleEntities,
pipetteEntities,
labwareNicknamesById,
labwareDefsByURI,
{}
{},
entities
)
expectResultToMatchSchema(result)

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

it('should return a valid Python protocol file', () => {
// @ts-expect-error(sa, 2021-6-15): resultFunc not part of Selector type
const result = createPythonFile.resultFunc(fileMetadata, OT2_ROBOT_TYPE, {})
const result = createPythonFile.resultFunc(
fileMetadata,
OT2_ROBOT_TYPE,
entities,
v7Fixture.initialRobotState
)
// This is just a quick smoke test to make sure createPythonFile() produces
// something that looks like a Python file. The individual sections of the
// generated Python will be tested in separate unit tests.
Expand Down
8 changes: 4 additions & 4 deletions protocol-designer/src/file-data/selectors/pythonFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,10 @@ export function pythonDefRun(
invariantContext: InvariantContext,
robotState: TimelineFrame
): string {
const loadModules = getLoadModules(
invariantContext.moduleEntities,
robotState.modules
)
const { moduleEntities } = invariantContext

const loadModules = getLoadModules(moduleEntities, robotState.modules)

const sections: string[] = [
...loadModules,
// loadLabware(),
Expand Down

0 comments on commit a08634a

Please sign in to comment.