Skip to content

Commit f823458

Browse files
refactor(shared-data): Rename getModuleDef2() -> getModuleDef() (#18834)
This function is called `getModuleDef2()` because it used to return `ModuleDefinition2` (module definition schema 2). It's actually returned schema 3 for a while, but its name never got updated.
1 parent 2b39209 commit f823458

File tree

24 files changed

+66
-66
lines changed

24 files changed

+66
-66
lines changed

app/src/molecules/ModuleInfo/ModuleInfo.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from '@opentrons/components'
1818
import {
1919
FLEX_STACKER_MODULE_TYPE,
20-
getModuleDef2,
20+
getModuleDef,
2121
getModuleDisplayName,
2222
MAGNETIC_BLOCK_V1,
2323
} from '@opentrons/shared-data'
@@ -36,7 +36,7 @@ export interface ModuleInfoProps {
3636

3737
export const ModuleInfo = (props: ModuleInfoProps): JSX.Element => {
3838
const { moduleModel, physicalPort, isAttached, runId = null } = props
39-
const moduleDef = getModuleDef2(moduleModel)
39+
const moduleDef = getModuleDef(moduleModel)
4040
const {
4141
xDimension,
4242
yDimension,

app/src/organisms/Desktop/Devices/ProtocolRun/SetupLabware/__tests__/SetupLabwareMap.test.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { when } from 'vitest-when'
66
import { BaseDeck } from '@opentrons/components'
77
import {
88
fixtureTiprack300ul,
9-
getModuleDef2,
9+
getModuleDef,
1010
OT2_ROBOT_TYPE,
1111
} from '@opentrons/shared-data'
1212

@@ -32,10 +32,10 @@ vi.mock('@opentrons/components', async importOriginal => {
3232
}
3333
})
3434
vi.mock('@opentrons/shared-data', async importOriginal => {
35-
const actualSharedData = await importOriginal<typeof getModuleDef2>()
35+
const actualSharedData = await importOriginal<typeof getModuleDef>()
3636
return {
3737
...actualSharedData,
38-
getModuleDef2: vi.fn(),
38+
getModuleDef: vi.fn(),
3939
}
4040
})
4141

@@ -181,10 +181,10 @@ describe('SetupLabwareMap', () => {
181181
},
182182
])
183183

184-
when(vi.mocked(getModuleDef2))
184+
when(vi.mocked(getModuleDef))
185185
.calledWith(mockMagneticModule.model)
186186
.thenReturn(mockMagneticModule as any)
187-
when(vi.mocked(getModuleDef2))
187+
when(vi.mocked(getModuleDef))
188188
.calledWith(mockTCModule.model)
189189
.thenReturn(mockTCModule as any)
190190

app/src/organisms/ErrorRecoveryFlows/hooks/__tests__/useDeckMapUtils.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { getLabwareLocation } from '@opentrons/components'
44
import {
55
fixture96Plate,
66
getLoadedLabwareDefinitionsByUri,
7-
getModuleDef2,
7+
getModuleDef,
88
getPositionFromSlotId,
99
TEMPERATURE_MODULE_V2,
1010
} from '@opentrons/shared-data'
@@ -30,7 +30,7 @@ vi.mock('@opentrons/shared-data', async importOriginal => {
3030
...actual,
3131
getLoadedLabwareDefinitionsByUri: vi.fn(),
3232
getPositionFromSlotId: vi.fn(),
33-
getModuleDef2: vi.fn(),
33+
getModuleDef: vi.fn(),
3434
}
3535
})
3636
vi.mock('@opentrons/components')
@@ -59,7 +59,7 @@ describe('getRunCurrentModulesOnDeck', () => {
5959
]
6060

6161
beforeEach(() => {
62-
vi.mocked(getModuleDef2).mockReturnValue({ model: 'MOCK_MODEL' } as any)
62+
vi.mocked(getModuleDef).mockReturnValue({ model: 'MOCK_MODEL' } as any)
6363
vi.mocked(getLabwareLocation).mockReturnValue({ slotName: 'A1' })
6464
})
6565

@@ -274,7 +274,7 @@ describe('getRunCurrentModulesInfo', () => {
274274
'opentrons/opentrons_96_pcr_adapter/1': 'MOCK_LW_DEF',
275275
} as any)
276276
vi.mocked(getPositionFromSlotId).mockReturnValue('position' as any)
277-
vi.mocked(getModuleDef2).mockReturnValue('MOCK_MODULE_DEF' as any)
277+
vi.mocked(getModuleDef).mockReturnValue('MOCK_MODULE_DEF' as any)
278278
})
279279

280280
it('should return an empty array if runRecord is null', () => {

app/src/organisms/ErrorRecoveryFlows/hooks/useDeckMapUtils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
FLEX_ROBOT_TYPE,
66
getDeckDefFromRobotType,
77
getFixedTrashLabwareDefinition,
8-
getModuleDef2,
8+
getModuleDef,
99
getPositionFromSlotId,
1010
getSimplestDeckConfigForProtocol,
1111
OT2_ROBOT_TYPE,
@@ -279,7 +279,7 @@ export const getRunCurrentModulesInfo = ({
279279
} else {
280280
return runRecord.data.modules.reduce<RunCurrentModuleInfo[]>(
281281
(acc, module) => {
282-
const moduleDef = getModuleDef2(module.model)
282+
const moduleDef = getModuleDef(module.model)
283283

284284
// Get the labware that is placed on top of the module.
285285
const nestedLabware = runRecord.data.labware.find(

app/src/organisms/InterventionModal/__fixtures__/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
getModuleDef2,
2+
getModuleDef,
33
SPAN7_8_10_11_SLOT,
44
THERMOCYCLER_MODULE_V1,
55
} from '@opentrons/shared-data'
@@ -228,7 +228,7 @@ export const mockModuleRenderInfoWithLabware = [
228228
moduleId: 'mockTCModuleID',
229229
x: 100,
230230
y: 100,
231-
moduleDef: getModuleDef2(THERMOCYCLER_MODULE_V1),
231+
moduleDef: getModuleDef(THERMOCYCLER_MODULE_V1),
232232
nestedLabwareDef: mockLabwareDefinition,
233233
nestedLabwareId: 'mockLabwareID',
234234
},
@@ -239,7 +239,7 @@ export const mockModuleRenderInfoWithoutLabware = [
239239
moduleId: 'mockTCModuleID',
240240
x: 100,
241241
y: 100,
242-
moduleDef: getModuleDef2(THERMOCYCLER_MODULE_V1),
242+
moduleDef: getModuleDef(THERMOCYCLER_MODULE_V1),
243243
nestedLabwareDef: null,
244244
nestedLabwareId: null,
245245
},

app/src/organisms/InterventionModal/utils/getRunModuleRenderInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {
2-
getModuleDef2,
2+
getModuleDef,
33
getPositionFromSlotId,
44
SPAN7_8_10_11_SLOT,
55
} from '@opentrons/shared-data'
@@ -28,7 +28,7 @@ export function getRunModuleRenderInfo(
2828
): RunModuleInfo[] {
2929
if (runData.modules.length > 0) {
3030
return runData.modules.reduce<RunModuleInfo[]>((acc, module) => {
31-
const moduleDef = getModuleDef2(module.model)
31+
const moduleDef = getModuleDef(module.model)
3232
const nestedLabware = runData.labware.find(
3333
labware =>
3434
typeof labware.location === 'object' &&

app/src/organisms/ODD/ProtocolSetup/ProtocolSetupModulesAndDeck/__tests__/utils.test.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
22

3-
import { getModuleDef2 } from '@opentrons/shared-data'
3+
import { getModuleDef } from '@opentrons/shared-data'
44

55
import { mockTemperatureModuleGen2 } from '/app/redux/modules/__fixtures__'
66

@@ -11,7 +11,7 @@ const temperatureProtocolModule = {
1111
x: 0,
1212
y: 0,
1313
z: 0,
14-
moduleDef: getModuleDef2('temperatureModuleV2'),
14+
moduleDef: getModuleDef('temperatureModuleV2'),
1515
nestedLabwareDef: null,
1616
nestedLabwareId: null,
1717
nestedLabwareDisplayName: null,
@@ -24,7 +24,7 @@ const magneticProtocolModule = {
2424
x: 0,
2525
y: 0,
2626
z: 0,
27-
moduleDef: getModuleDef2('magneticModuleV2'),
27+
moduleDef: getModuleDef('magneticModuleV2'),
2828
nestedLabwareDef: null,
2929
nestedLabwareId: null,
3030
nestedLabwareDisplayName: null,

app/src/transformations/analysis/__tests__/getAttachedProtocolModuleMatches.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest'
22

33
import {
4-
getModuleDef2,
4+
getModuleDef,
55
TEMPERATURE_MODULE_V2_FIXTURE,
66
} from '@opentrons/shared-data'
77

@@ -14,7 +14,7 @@ const temperatureProtocolModule = {
1414
x: 0,
1515
y: 0,
1616
z: 0,
17-
moduleDef: getModuleDef2('temperatureModuleV2'),
17+
moduleDef: getModuleDef('temperatureModuleV2'),
1818
nestedLabwareDef: null,
1919
nestedLabwareId: null,
2020
nestedLabwareDisplayName: null,
@@ -27,7 +27,7 @@ const magneticProtocolModule = {
2727
x: 0,
2828
y: 0,
2929
z: 0,
30-
moduleDef: getModuleDef2('magneticModuleV2'),
30+
moduleDef: getModuleDef('magneticModuleV2'),
3131
nestedLabwareDef: null,
3232
nestedLabwareId: null,
3333
nestedLabwareDisplayName: null,

app/src/transformations/analysis/__tests__/getProtocolModulesInfo.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { describe, expect, it } from 'vitest'
22

33
import {
4-
getModuleDef2,
4+
getModuleDef,
55
multiple_temp_modules,
66
ot2DeckDefV5,
77
transfer_settings,
@@ -210,7 +210,7 @@ describe('getProtocolModulesInfo', () => {
210210
x: SLOT_1_COORDS[0],
211211
y: SLOT_1_COORDS[1],
212212
z: SLOT_1_COORDS[2],
213-
moduleDef: getModuleDef2('magneticModuleV2'),
213+
moduleDef: getModuleDef('magneticModuleV2'),
214214
nestedLabwareDef:
215215
transfer_settings.labwareDefinitions[
216216
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
@@ -225,7 +225,7 @@ describe('getProtocolModulesInfo', () => {
225225
x: SLOT_3_COORDS[0],
226226
y: SLOT_3_COORDS[1],
227227
z: SLOT_3_COORDS[2],
228-
moduleDef: getModuleDef2('temperatureModuleV2'),
228+
moduleDef: getModuleDef('temperatureModuleV2'),
229229
nestedLabwareDef:
230230
transfer_settings.labwareDefinitions[
231231
'opentrons/opentrons_96_aluminumblock_generic_pcr_strip_200ul/1'
@@ -241,7 +241,7 @@ describe('getProtocolModulesInfo', () => {
241241
x: SLOT_7_COORDS[0],
242242
y: SLOT_7_COORDS[1],
243243
z: SLOT_7_COORDS[2],
244-
moduleDef: getModuleDef2('thermocyclerModuleV1'),
244+
moduleDef: getModuleDef('thermocyclerModuleV1'),
245245
nestedLabwareDef:
246246
transfer_settings.labwareDefinitions[
247247
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
@@ -286,7 +286,7 @@ describe('getProtocolModulesInfo', () => {
286286
x: SLOT_1_COORDS[0],
287287
y: SLOT_1_COORDS[1],
288288
z: SLOT_1_COORDS[2],
289-
moduleDef: getModuleDef2('magneticModuleV2'),
289+
moduleDef: getModuleDef('magneticModuleV2'),
290290
nestedLabwareDef:
291291
multiple_temp_modules.labwareDefinitions[
292292
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
@@ -301,7 +301,7 @@ describe('getProtocolModulesInfo', () => {
301301
x: SLOT_3_COORDS[0],
302302
y: SLOT_3_COORDS[1],
303303
z: SLOT_3_COORDS[2],
304-
moduleDef: getModuleDef2('temperatureModuleV2'),
304+
moduleDef: getModuleDef('temperatureModuleV2'),
305305
nestedLabwareDef:
306306
multiple_temp_modules.labwareDefinitions[
307307
'opentrons/opentrons_96_aluminumblock_generic_pcr_strip_200ul/1'
@@ -317,7 +317,7 @@ describe('getProtocolModulesInfo', () => {
317317
x: SLOT_7_COORDS[0],
318318
y: SLOT_7_COORDS[1],
319319
z: SLOT_7_COORDS[2],
320-
moduleDef: getModuleDef2('temperatureModuleV2'),
320+
moduleDef: getModuleDef('temperatureModuleV2'),
321321
nestedLabwareDef:
322322
multiple_temp_modules.labwareDefinitions[
323323
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'
@@ -350,7 +350,7 @@ describe('getProtocolModulesInfo', () => {
350350
x: SLOT_1_COORDS[0],
351351
y: SLOT_1_COORDS[1],
352352
z: SLOT_1_COORDS[2],
353-
moduleDef: getModuleDef2('magneticModuleV2'),
353+
moduleDef: getModuleDef('magneticModuleV2'),
354354
nestedLabwareDef:
355355
transfer_settings.labwareDefinitions[
356356
'opentrons/nest_96_wellplate_100ul_pcr_full_skirt/1'

app/src/transformations/analysis/getProtocolModulesInfo.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import {
22
getLoadedLabwareDefinitionsByUri,
3-
getModuleDef2,
3+
getModuleDef,
44
getPositionFromSlotId,
55
SPAN7_8_10_11_SLOT,
66
} from '@opentrons/shared-data'
@@ -35,7 +35,7 @@ export const getProtocolModulesInfo = (
3535
): ProtocolModuleInfo[] => {
3636
if (protocolData != null && 'modules' in protocolData) {
3737
return protocolData.modules.reduce<ProtocolModuleInfo[]>((acc, module) => {
38-
const moduleDef = getModuleDef2(module.model)
38+
const moduleDef = getModuleDef(module.model)
3939
const nestedLabwareId =
4040
protocolData.commands
4141
.filter(

0 commit comments

Comments
 (0)