1
1
import { describe , it , expect , vi } from 'vitest'
2
2
import {
3
+ DEFAULT_PIPETTE ,
3
4
getInitialRobotStateStandard ,
4
5
getSuccessResult ,
5
6
makeContext ,
6
7
} from '../fixtures'
8
+ import { PROTOCOL_CONTEXT_NAME } from '../utils'
7
9
import { blowOutInTrash } from '../commandCreators/compound'
8
10
import type { CutoutId } from '@opentrons/shared-data'
9
11
import type { InvariantContext , RobotState } from '../types'
10
12
11
13
vi . mock ( '../getNextRobotStateAndWarnings/dispenseUpdateLiquidState' )
12
14
13
- const mockId = 'mockId'
14
15
const mockCutout : CutoutId = 'cutoutA3'
15
- const invariantContext : InvariantContext = makeContext ( )
16
+ const mockTrashId = 'mockTrashId'
17
+ let invariantContext : InvariantContext = {
18
+ ...makeContext ( ) ,
19
+ additionalEquipmentEntities : {
20
+ [ mockTrashId ] : {
21
+ id : mockTrashId ,
22
+ name : 'trashBin' ,
23
+ pythonName : 'mock_trash_bin_1' ,
24
+ location : mockCutout ,
25
+ } ,
26
+ } ,
27
+ }
16
28
const prevRobotState : RobotState = getInitialRobotStateStandard (
17
29
invariantContext
18
30
)
19
31
20
32
describe ( 'blowOutInTrash' , ( ) => {
21
- it ( 'returns correct commands for blowout in a trash bin' , ( ) => {
33
+ it ( 'returns correct commands for blowout in a trash bin for a flex ' , ( ) => {
22
34
const result = blowOutInTrash (
23
35
{
24
- pipetteId : mockId ,
36
+ pipetteId : DEFAULT_PIPETTE ,
25
37
flowRate : 10 ,
26
- trashLocation : mockCutout ,
38
+ trashId : mockTrashId ,
27
39
} ,
28
40
invariantContext ,
29
41
prevRobotState
@@ -33,7 +45,7 @@ describe('blowOutInTrash', () => {
33
45
commandType : 'moveToAddressableArea' ,
34
46
key : expect . any ( String ) ,
35
47
params : {
36
- pipetteId : mockId ,
48
+ pipetteId : DEFAULT_PIPETTE ,
37
49
addressableAreaName : 'movableTrashA3' ,
38
50
offset : { x : 0 , y : 0 , z : 0 } ,
39
51
} ,
@@ -42,10 +54,62 @@ describe('blowOutInTrash', () => {
42
54
commandType : 'blowOutInPlace' ,
43
55
key : expect . any ( String ) ,
44
56
params : {
45
- pipetteId : mockId ,
57
+ pipetteId : DEFAULT_PIPETTE ,
46
58
flowRate : 10 ,
47
59
} ,
48
60
} ,
49
61
] )
62
+ expect ( getSuccessResult ( result ) . python ) . toBe (
63
+ `
64
+ mockPythonName.flow_rate.blow_out = 10
65
+ mockPythonName.blow_out(mock_trash_bin_1)` . trim ( )
66
+ )
67
+ } )
68
+ it ( 'returns correct commands for blowout in a trash bin for an ot-2' , ( ) => {
69
+ const mockFixedTrashId = 'fixedTrashId'
70
+ invariantContext = {
71
+ ...invariantContext ,
72
+ additionalEquipmentEntities : {
73
+ [ mockFixedTrashId ] : {
74
+ id : mockFixedTrashId ,
75
+ name : 'trashBin' ,
76
+ pythonName : `${ PROTOCOL_CONTEXT_NAME } .fixed_trash` ,
77
+ location : 'cutout12' ,
78
+ } ,
79
+ } ,
80
+ }
81
+ const result = blowOutInTrash (
82
+ {
83
+ pipetteId : DEFAULT_PIPETTE ,
84
+ flowRate : 10 ,
85
+ trashId : mockFixedTrashId ,
86
+ } ,
87
+ invariantContext ,
88
+ prevRobotState
89
+ )
90
+ expect ( getSuccessResult ( result ) . commands ) . toEqual ( [
91
+ {
92
+ commandType : 'moveToAddressableArea' ,
93
+ key : expect . any ( String ) ,
94
+ params : {
95
+ pipetteId : DEFAULT_PIPETTE ,
96
+ addressableAreaName : 'fixedTrash' ,
97
+ offset : { x : 0 , y : 0 , z : 0 } ,
98
+ } ,
99
+ } ,
100
+ {
101
+ commandType : 'blowOutInPlace' ,
102
+ key : expect . any ( String ) ,
103
+ params : {
104
+ pipetteId : DEFAULT_PIPETTE ,
105
+ flowRate : 10 ,
106
+ } ,
107
+ } ,
108
+ ] )
109
+ expect ( getSuccessResult ( result ) . python ) . toBe (
110
+ `
111
+ mockPythonName.flow_rate.blow_out = 10
112
+ mockPythonName.blow_out(protocol.fixed_trash)` . trim ( )
113
+ )
50
114
} )
51
115
} )
0 commit comments