@@ -187,5 +187,51 @@ describe("Project Changes Service Tests", () => {
187
187
assert . deepEqual ( actualPrepareInfo , { nativePlatformStatus : Constants . NativePlatformStatus . requiresPrepare } ) ;
188
188
}
189
189
} ) ;
190
+
191
+ it ( `shouldn't reset prepare info when native platform status is ${ Constants . NativePlatformStatus . alreadyPrepared } and there is existing prepare info` , async ( ) => {
192
+ for ( const platform of [ "ios" , "android" ] ) {
193
+ await serviceTest . projectChangesService . checkForChanges ( {
194
+ platform,
195
+ projectData : serviceTest . projectData ,
196
+ projectChangesOptions : {
197
+ bundle : false ,
198
+ release : false ,
199
+ provision : undefined ,
200
+ teamId : undefined ,
201
+ useHotModuleReload : false
202
+ }
203
+ } ) ;
204
+ serviceTest . projectChangesService . savePrepareInfo ( platform , serviceTest . projectData ) ;
205
+ const prepareInfo = serviceTest . projectChangesService . getPrepareInfo ( platform , serviceTest . projectData ) ;
206
+
207
+ serviceTest . projectChangesService . setNativePlatformStatus ( platform , serviceTest . projectData , { nativePlatformStatus : Constants . NativePlatformStatus . alreadyPrepared } ) ;
208
+
209
+ const actualPrepareInfo = serviceTest . projectChangesService . getPrepareInfo ( platform , serviceTest . projectData ) ;
210
+ prepareInfo . nativePlatformStatus = Constants . NativePlatformStatus . alreadyPrepared ;
211
+ assert . deepEqual ( actualPrepareInfo , prepareInfo ) ;
212
+ }
213
+ } ) ;
214
+
215
+ _ . each ( [ Constants . NativePlatformStatus . requiresPlatformAdd , Constants . NativePlatformStatus . requiresPrepare ] , nativePlatformStatus => {
216
+ it ( `should reset prepare info when native platform status is ${ nativePlatformStatus } and there is existing prepare info` , async ( ) => {
217
+ for ( const platform of [ "ios" , "android" ] ) {
218
+ await serviceTest . projectChangesService . checkForChanges ( {
219
+ platform,
220
+ projectData : serviceTest . projectData ,
221
+ projectChangesOptions : {
222
+ bundle : false ,
223
+ release : false ,
224
+ provision : undefined ,
225
+ teamId : undefined ,
226
+ useHotModuleReload : false
227
+ }
228
+ } ) ;
229
+ serviceTest . projectChangesService . setNativePlatformStatus ( platform , serviceTest . projectData , { nativePlatformStatus : nativePlatformStatus } ) ;
230
+
231
+ const actualPrepareInfo = serviceTest . projectChangesService . getPrepareInfo ( platform , serviceTest . projectData ) ;
232
+ assert . deepEqual ( actualPrepareInfo , { nativePlatformStatus : nativePlatformStatus } ) ;
233
+ }
234
+ } ) ;
235
+ } ) ;
190
236
} ) ;
191
237
} ) ;
0 commit comments