@@ -104,32 +104,51 @@ export const migrateAndMatchSnapshot = ({
104
104
savedFile . designerApplication . version as string
105
105
)
106
106
assert ( version !== null , 'PD version is not valid semver' )
107
+ const isBelowVersion850 = semver . lt ( version ?? '' , '8.5.0' )
107
108
108
109
const files = [ savedFile , expectedFile ]
109
110
files . forEach ( f => {
110
111
f . metadata . lastModified = 123
111
112
f . designerApplication . data . _internalAppBuildDate = 'Foo Date'
112
113
f . designerApplication . version = 'x.x.x'
113
114
114
- Object . values (
115
- f . designerApplication . data . savedStepForms as Record < string , unknown >
116
- ) . forEach ( stepForm => {
117
- const stepFormTyped = stepForm as {
118
- stepType : string
119
- dropTip_location ?: string
120
- blowout_location ?: string
115
+ const savedStepForms = f . designerApplication . data . savedStepForms
116
+ const initialDeckSetupStep = '__INITIAL_DECK_SETUP_STEP__'
117
+
118
+ // a uuid is randomly generated each time you upload a protocol that is less than version 8_5_0
119
+ // which is the migration version that adds these keys. Due to this, we need to ignore
120
+ // the uuids
121
+ if ( savedStepForms [ initialDeckSetupStep ] && isBelowVersion850 ) {
122
+ savedStepForms [ initialDeckSetupStep ] . trashBinLocationUpdate = {
123
+ trashBin : 'trashLocation' ,
124
+ }
125
+ savedStepForms [ initialDeckSetupStep ] . gripperLocationUpdate = {
126
+ gripper : 'gripperLocation' ,
121
127
}
122
- if ( stepFormTyped . stepType === 'moveLiquid' ) {
123
- stepFormTyped . dropTip_location = 'trash drop tip location'
124
- if ( stepFormTyped . blowout_location ?. includes ( 'trashBin' ) ?? false ) {
128
+ }
129
+
130
+ Object . values ( savedStepForms as Record < string , unknown > ) . forEach (
131
+ stepForm => {
132
+ const stepFormTyped = stepForm as {
133
+ stepType : string
134
+ dropTip_location ?: string
135
+ blowout_location ?: string
136
+ }
137
+ if ( stepFormTyped . stepType === 'moveLiquid' ) {
138
+ stepFormTyped . dropTip_location = 'trash drop tip location'
139
+ if (
140
+ stepFormTyped . blowout_location ?. includes ( 'trashBin' ) ??
141
+ false
142
+ ) {
143
+ stepFormTyped . blowout_location = 'trash blowout location'
144
+ }
145
+ }
146
+ if ( stepFormTyped . stepType === 'mix' ) {
147
+ stepFormTyped . dropTip_location = 'trash drop tip location'
125
148
stepFormTyped . blowout_location = 'trash blowout location'
126
149
}
127
150
}
128
- if ( stepFormTyped . stepType === 'mix' ) {
129
- stepFormTyped . dropTip_location = 'trash drop tip location'
130
- stepFormTyped . blowout_location = 'trash blowout location'
131
- }
132
- } )
151
+ )
133
152
134
153
f . commands . forEach ( ( command : { key : string } ) => {
135
154
if ( 'key' in command ) command . key = '123'
0 commit comments