Skip to content

Commit 71b9907

Browse files
authored
refactor(step-generation): consistent names for misc.ts location helper functions (#17848)
# Overview There are 4 helper functions in `misc.ts` that have the same structure of performing an action at some well or trash bin or waste chute: - `blowoutUtil()` - `dispenseLocationHelper()` - `airGapHelper()` - and coming soon: a `delay()`-at-location helper These are also the only functions that emit `CommandCreators` in `misc.ts`. I'd like to give them all consistent names to make them easier to recognize. So I'd like to rename them to: - `blowoutLocationHelper()` - `dispenseLocationHelper()` - `airGapLocationHelper()` - `delayLocationHelper()` (coming soon, will replace `moveHelper()`) ## Test Plan and Hands on Testing I'm relying on existing CI tests to make sure I don't break anything. ## Risk assessment Pure refactoring, there should be no functional change at all.
1 parent 328df5f commit 71b9907

File tree

6 files changed

+29
-29
lines changed

6 files changed

+29
-29
lines changed

step-generation/src/__tests__/blowoutUtil.test.ts

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { beforeEach, describe, it, expect, vi } from 'vitest'
22
import {
3-
blowoutUtil,
3+
blowoutLocationHelper,
44
SOURCE_WELL_BLOWOUT_DESTINATION,
55
DEST_WELL_BLOWOUT_DESTINATION,
66
} from '../utils'
@@ -34,7 +34,7 @@ let blowoutArgs: {
3434
invariantContext: InvariantContext
3535
prevRobotState: RobotState
3636
}
37-
describe('blowoutUtil', () => {
37+
describe('blowoutLocationHelper', () => {
3838
let invariantContext: InvariantContext
3939

4040
beforeEach(() => {
@@ -54,8 +54,8 @@ describe('blowoutUtil', () => {
5454
}
5555
vi.mocked(curryCommandCreator).mockClear()
5656
})
57-
it('blowoutUtil curries blowout with source well params', () => {
58-
blowoutUtil({
57+
it('blowoutLocationHelper curries blowout with source well params', () => {
58+
blowoutLocationHelper({
5959
...blowoutArgs,
6060
blowoutLocation: SOURCE_WELL_BLOWOUT_DESTINATION,
6161
})
@@ -72,7 +72,7 @@ describe('blowoutUtil', () => {
7272
},
7373
})
7474
})
75-
it('blowoutUtil curries waste chute commands when there is no well', () => {
75+
it('blowoutLocationHelper curries waste chute commands when there is no well', () => {
7676
const wasteChuteId = 'wasteChuteId'
7777
invariantContext = {
7878
...invariantContext,
@@ -84,7 +84,7 @@ describe('blowoutUtil', () => {
8484
},
8585
},
8686
}
87-
blowoutUtil({
87+
blowoutLocationHelper({
8888
...blowoutArgs,
8989
destLabwareId: wasteChuteId,
9090
invariantContext: invariantContext,
@@ -97,8 +97,8 @@ describe('blowoutUtil', () => {
9797
wasteChuteId,
9898
})
9999
})
100-
it('blowoutUtil curries blowout with dest plate params', () => {
101-
blowoutUtil({
100+
it('blowoutLocationHelper curries blowout with dest plate params', () => {
101+
blowoutLocationHelper({
102102
...blowoutArgs,
103103
blowoutLocation: DEST_WELL_BLOWOUT_DESTINATION,
104104
})
@@ -115,8 +115,8 @@ describe('blowoutUtil', () => {
115115
},
116116
})
117117
})
118-
it('blowoutUtil curries blowout with an arbitrary labware Id', () => {
119-
blowoutUtil({
118+
it('blowoutLocationHelper curries blowout with an arbitrary labware Id', () => {
119+
blowoutLocationHelper({
120120
...blowoutArgs,
121121
blowoutLocation: TROUGH_LABWARE,
122122
})
@@ -133,8 +133,8 @@ describe('blowoutUtil', () => {
133133
},
134134
})
135135
})
136-
it('blowoutUtil returns an empty array if not given a blowoutLocation', () => {
137-
const result = blowoutUtil({
136+
it('blowoutLocationHelper returns an empty array if not given a blowoutLocation', () => {
137+
const result = blowoutLocationHelper({
138138
...blowoutArgs,
139139
blowoutLocation: null,
140140
})

step-generation/src/commandCreators/compound/consolidate.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ import * as errorCreators from '../../errorCreators'
99
import { getPipetteWithTipMaxVol } from '../../robotStateSelectors'
1010
import { dropTipInTrash } from './dropTipInTrash'
1111
import {
12-
blowoutUtil,
12+
blowoutLocationHelper,
1313
curryCommandCreator,
1414
reduceCommandCreators,
15-
airGapHelper,
15+
airGapLocationHelper,
1616
dispenseLocationHelper,
1717
moveHelper,
1818
getIsSafePipetteMovement,
@@ -383,7 +383,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
383383
]
384384
: []
385385

386-
const blowoutCommand = blowoutUtil({
386+
const blowoutCommand = blowoutLocationHelper({
387387
pipette: args.pipette,
388388
sourceLabwareId: args.sourceLabware,
389389
sourceWell: sourceWellChunk[0],
@@ -399,7 +399,7 @@ export const consolidate: CommandCreator<ConsolidateArgs> = (
399399
const airGapAfterDispenseCommands =
400400
dispenseAirGapVolume && !willReuseTip
401401
? [
402-
curryCommandCreator(airGapHelper, {
402+
curryCommandCreator(airGapLocationHelper, {
403403
pipetteId: args.pipette,
404404
volume: dispenseAirGapVolume,
405405
destinationId: args.destLabware,

step-generation/src/commandCreators/compound/distribute.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,11 @@ import { dropTipInTrash } from './dropTipInTrash'
1313
import {
1414
curryCommandCreator,
1515
reduceCommandCreators,
16-
blowoutUtil,
16+
blowoutLocationHelper,
1717
getDispenseAirGapLocation,
1818
getIsSafePipetteMovement,
1919
getHasWasteChute,
20-
airGapHelper,
20+
airGapLocationHelper,
2121
} from '../../utils'
2222
import {
2323
aspirate,
@@ -325,7 +325,7 @@ export const distribute: CommandCreator<DistributeArgs> = (
325325
const airGapAfterDispenseCommands =
326326
dispenseAirGapVolume && !willReuseTip
327327
? [
328-
curryCommandCreator(airGapHelper, {
328+
curryCommandCreator(airGapLocationHelper, {
329329
pipetteId: args.pipette,
330330
destinationId: dispenseAirGapLabware,
331331
destWell: dispenseAirGapWell,
@@ -369,7 +369,7 @@ export const distribute: CommandCreator<DistributeArgs> = (
369369
const dropTipAfterDispenseAirGap =
370370
airGapAfterDispenseCommands.length > 0 ? dropTipCommand : []
371371
const blowoutCommands = disposalVolume
372-
? blowoutUtil({
372+
? blowoutLocationHelper({
373373
pipette: pipette,
374374
sourceLabwareId: args.sourceLabware,
375375
sourceWell: args.sourceWell,

step-generation/src/commandCreators/compound/mix.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from '@opentrons/shared-data'
77
import {
88
repeatArray,
9-
blowoutUtil,
9+
blowoutLocationHelper,
1010
curryCommandCreator,
1111
reduceCommandCreators,
1212
getIsSafePipetteMovement,
@@ -260,7 +260,7 @@ export const mix: CommandCreator<MixArgs> = (
260260
}),
261261
]
262262
: []
263-
const blowoutCommand = blowoutUtil({
263+
const blowoutCommand = blowoutLocationHelper({
264264
pipette: data.pipette,
265265
sourceLabwareId: data.labware,
266266
sourceWell: well,

step-generation/src/commandCreators/compound/transfer.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import * as errorCreators from '../../errorCreators'
88
import { getPipetteWithTipMaxVol } from '../../robotStateSelectors'
99
import { dropTipInTrash } from './dropTipInTrash'
1010
import {
11-
blowoutUtil,
11+
blowoutLocationHelper,
1212
curryCommandCreator,
13-
airGapHelper,
13+
airGapLocationHelper,
1414
reduceCommandCreators,
1515
getTrashOrLabware,
1616
dispenseLocationHelper,
@@ -475,7 +475,7 @@ export const transfer: CommandCreator<TransferArgs> = (
475475
]
476476
: []
477477

478-
const blowoutCommand = blowoutUtil({
478+
const blowoutCommand = blowoutLocationHelper({
479479
pipette: args.pipette,
480480
sourceLabwareId: args.sourceLabware,
481481
sourceWell: sourceWell,
@@ -490,7 +490,7 @@ export const transfer: CommandCreator<TransferArgs> = (
490490
const airGapAfterDispenseCommands =
491491
dispenseAirGapVolume && !willReuseTip
492492
? [
493-
curryCommandCreator(airGapHelper, {
493+
curryCommandCreator(airGapLocationHelper, {
494494
sourceWell,
495495
blowOutLocation: args.blowoutLocation,
496496
sourceId: args.sourceLabware,

step-generation/src/utils/misc.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ export function getWellsForTips(
317317
// Set blowout location depending on the 'blowoutLocation' arg: set it to
318318
// the SOURCE_WELL_BLOWOUT_DESTINATION / DEST_WELL_BLOWOUT_DESTINATION
319319
// special strings, or to a labware ID.
320-
export const blowoutUtil = (args: {
320+
export const blowoutLocationHelper = (args: {
321321
pipette: BlowoutParams['pipetteId']
322322
sourceLabwareId: string
323323
sourceWell: BlowoutParams['wellName']
@@ -702,7 +702,7 @@ export const moveHelper: CommandCreator<MoveHelperArgs> = (
702702
return reduceCommandCreators(commands, invariantContext, prevRobotState)
703703
}
704704

705-
interface AirGapArgs {
705+
interface AirGapLocationArgs {
706706
// destinationId is either labware or addressableAreaName for waste chute
707707
destinationId: string
708708
destWell: string | null
@@ -713,7 +713,7 @@ interface AirGapArgs {
713713
sourceId?: string
714714
sourceWell?: string
715715
}
716-
export const airGapHelper: CommandCreator<AirGapArgs> = (
716+
export const airGapLocationHelper: CommandCreator<AirGapLocationArgs> = (
717717
args,
718718
invariantContext,
719719
prevRobotState

0 commit comments

Comments
 (0)