Skip to content

Commit

Permalink
add vitest and modify json import
Browse files Browse the repository at this point in the history
  • Loading branch information
koji committed Mar 1, 2024
1 parent e4afa9d commit 28b626f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 23 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import _protocolWithMagTempTC from '@opentrons/shared-data/protocol/fixtures/6/transferSettings.json'
import { describe, it, expect } from 'vitest'
import { transfer_settings } from '@opentrons/shared-data'
import { getModuleInitialLoadInfo } from '../getModuleInitialLoadInfo'
import { CompletedProtocolAnalysis } from '@opentrons/shared-data'
import type { LoadModuleRunTimeCommand } from '@opentrons/shared-data'

const protocolWithMagTempTC = (_protocolWithMagTempTC as unknown) as CompletedProtocolAnalysis
const protocolWithMagTempTC = (transfer_settings as unknown) as CompletedProtocolAnalysis

describe('getModuleInitialLoadInfo', () => {
it('should gather protocol module info for tc if id in params', () => {
const TC_ID: keyof typeof _protocolWithMagTempTC.modules =
const TC_ID: keyof typeof transfer_settings.modules =
'3e039550-3412-11eb-ad93-ed232a2337cf:thermocyclerModuleType'

expect(
Expand All @@ -20,7 +21,7 @@ describe('getModuleInitialLoadInfo', () => {
})
})
it('should gather protocol module info for tc if id not in params', () => {
const TC_ID: keyof typeof _protocolWithMagTempTC.modules =
const TC_ID: keyof typeof transfer_settings.modules =
'3e039550-3412-11eb-ad93-ed232a2337cf:thermocyclerModuleType'

const LOAD_TC_COMMAND: LoadModuleRunTimeCommand = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import _protocolWithMagTempTC from '@opentrons/shared-data/protocol/fixtures/6/transferSettings.json'
import _protocolWithMultipleTemps from '@opentrons/shared-data/protocol/fixtures/6/multipleTempModules.json'
import _standardDeckDef from '@opentrons/shared-data/deck/definitions/4/ot2_standard.json'
import { describe, it, expect } from 'vitest'
import {
transfer_settings,
multiple_temp_modules,
ot2DeckDefV4,
} from '@opentrons/shared-data'
import { getProtocolModulesInfo } from '../getProtocolModulesInfo'
import {
getModuleDef2,
Expand All @@ -10,7 +13,7 @@ import {
} from '@opentrons/shared-data'

const protocolWithMagTempTC = ({
..._protocolWithMagTempTC,
...transfer_settings,
labware: [
{
id: 'fixedTrash',
Expand Down Expand Up @@ -92,7 +95,7 @@ const protocolWithMagTempTC = ({
] as LoadedModule[],
} as unknown) as ProtocolAnalysisOutput
const protocolWithMultipleTemps = ({
..._protocolWithMultipleTemps,
...multiple_temp_modules,
labware: [
{
id: 'fixedTrash',
Expand Down Expand Up @@ -173,7 +176,7 @@ const protocolWithMultipleTemps = ({
},
] as LoadedModule[],
} as unknown) as ProtocolAnalysisOutput
const standardDeckDef = _standardDeckDef as any
const standardDeckDef = ot2DeckDefV4 as any

describe('getProtocolModulesInfo', () => {
it('should gather protocol module info for temp, mag, and tc', () => {
Expand All @@ -184,11 +187,11 @@ describe('getProtocolModulesInfo', () => {
// TC takes up rests in slot 7 which has [x,y] coordinate [0,181,0]
const SLOT_7_COORDS = [0, 181, 0]
// these ids come from the protocol fixture
const MAG_MOD_ID: keyof typeof _protocolWithMagTempTC.modules =
const MAG_MOD_ID: keyof typeof transfer_settings.modules =
'3e012450-3412-11eb-ad93-ed232a2337cf:magneticModuleType'
const TEMP_MOD_ID: keyof typeof _protocolWithMagTempTC.modules =
const TEMP_MOD_ID: keyof typeof transfer_settings.modules =
'3e0283e0-3412-11eb-ad93-ed232a2337cf:temperatureModuleType'
const TC_ID: keyof typeof _protocolWithMagTempTC.modules =
const TC_ID: keyof typeof transfer_settings.modules =
'3e039550-3412-11eb-ad93-ed232a2337cf:thermocyclerModuleType'

const MAG_LW_ID =
Expand All @@ -206,7 +209,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_1_COORDS[2],
moduleDef: getModuleDef2('magneticModuleV2'),
nestedLabwareDef:
_protocolWithMagTempTC.labwareDefinitions[
transfer_settings.labwareDefinitions[
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
],
nestedLabwareId: MAG_LW_ID,
Expand All @@ -221,7 +224,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_3_COORDS[2],
moduleDef: getModuleDef2('temperatureModuleV2'),
nestedLabwareDef:
_protocolWithMagTempTC.labwareDefinitions[
transfer_settings.labwareDefinitions[
'opentrons/opentrons_96_aluminumblock_generic_pcr_strip_200ul/1'
],
nestedLabwareId: TEMP_LW_ID,
Expand All @@ -237,7 +240,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_7_COORDS[2],
moduleDef: getModuleDef2('thermocyclerModuleV1'),
nestedLabwareDef:
_protocolWithMagTempTC.labwareDefinitions[
transfer_settings.labwareDefinitions[
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
],
nestedLabwareId: TC_LW_ID,
Expand All @@ -260,11 +263,11 @@ describe('getProtocolModulesInfo', () => {
// TC takes up rests in slot 7 which has [x,y] coordinate [0,181,0]
const SLOT_7_COORDS = [0, 181, 0]
// these ids come from the protocol fixture
const MAG_MOD_ID: keyof typeof _protocolWithMultipleTemps.modules =
const MAG_MOD_ID: keyof typeof multiple_temp_modules.modules =
'3e012450-3412-11eb-ad93-ed232a2337cf:magneticModuleType'
const TEMP_MOD_ONE_ID: keyof typeof _protocolWithMultipleTemps.modules =
const TEMP_MOD_ONE_ID: keyof typeof multiple_temp_modules.modules =
'3e0283e0-3412-11eb-ad93-ed232a2337cf:temperatureModuleType1'
const TEMP_MOD_TWO_ID: keyof typeof _protocolWithMultipleTemps.modules =
const TEMP_MOD_TWO_ID: keyof typeof multiple_temp_modules.modules =
'3e039550-3412-11eb-ad93-ed232a2337cf:temperatureModuleType2'

const MAG_LW_ID =
Expand All @@ -282,7 +285,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_1_COORDS[2],
moduleDef: getModuleDef2('magneticModuleV2'),
nestedLabwareDef:
_protocolWithMultipleTemps.labwareDefinitions[
multiple_temp_modules.labwareDefinitions[
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
],
nestedLabwareId: MAG_LW_ID,
Expand All @@ -297,7 +300,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_3_COORDS[2],
moduleDef: getModuleDef2('temperatureModuleV2'),
nestedLabwareDef:
_protocolWithMultipleTemps.labwareDefinitions[
multiple_temp_modules.labwareDefinitions[
'opentrons/opentrons_96_aluminumblock_generic_pcr_strip_200ul/1'
],
nestedLabwareId: TEMP_ONE_LW_ID,
Expand All @@ -313,7 +316,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_7_COORDS[2],
moduleDef: getModuleDef2('temperatureModuleV2'),
nestedLabwareDef:
_protocolWithMultipleTemps.labwareDefinitions[
multiple_temp_modules.labwareDefinitions[
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
],
nestedLabwareId: TEMP_TWO_LW_ID,
Expand Down Expand Up @@ -346,7 +349,7 @@ describe('getProtocolModulesInfo', () => {
z: SLOT_1_COORDS[2],
moduleDef: getModuleDef2('magneticModuleV2'),
nestedLabwareDef:
_protocolWithMagTempTC.labwareDefinitions[
transfer_settings.labwareDefinitions[
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
],
nestedLabwareId: MAG_LW_ID,
Expand Down

0 comments on commit 28b626f

Please sign in to comment.