@@ -465,12 +465,14 @@ const ScenarioInstall = "scenarioInstall.js";
465
465
const ScenarioInstallOnResumeWithRevert = "scenarioInstallOnResumeWithRevert.js" ;
466
466
const ScenarioInstallOnRestartWithRevert = "scenarioInstallOnRestartWithRevert.js" ;
467
467
const ScenarioInstallWithRevert = "scenarioInstallWithRevert.js" ;
468
+ const ScenarioInstallRestart2x = "scenarioInstallRestart2x.js" ;
468
469
const ScenarioSync1x = "scenarioSync.js" ;
469
470
const ScenarioSyncResume = "scenarioSyncResume.js" ;
470
471
const ScenarioSyncResumeDelay = "scenarioSyncResumeDelay.js" ;
471
472
const ScenarioSyncRestartDelay = "scenarioSyncResumeDelay.js" ;
472
473
const ScenarioSync2x = "scenarioSync2x.js" ;
473
474
const ScenarioRestart = "scenarioRestart.js" ;
475
+ const ScenarioRestart2x = "scenarioRestart2x.js" ;
474
476
const ScenarioSyncMandatoryDefault = "scenarioSyncMandatoryDefault.js" ;
475
477
const ScenarioSyncMandatoryResume = "scenarioSyncMandatoryResume.js" ;
476
478
const ScenarioSyncMandatoryRestart = "scenarioSyncMandatoryRestart.js" ;
@@ -986,6 +988,43 @@ PluginTestingFramework.initializeTests(new RNProjectManager(), supportedTargetPl
986
988
} ) ;
987
989
} , ScenarioRestart ) ;
988
990
991
+ TestBuilder . describe ( "#codePush.restartApplication.2x" ,
992
+ ( ) => {
993
+ TestBuilder . it ( "blocks when a restart is in progress and doesn't crash if there is a pending package" , false ,
994
+ ( done : MochaDone ) => {
995
+ ServerUtil . updateResponse = { updateInfo : ServerUtil . createUpdateResponse ( false , targetPlatform ) } ;
996
+ setupTestRunScenario ( projectManager , targetPlatform , ScenarioInstallRestart2x )
997
+ . then ( setupUpdateScenario . bind ( this , projectManager , targetPlatform , UpdateDeviceReady , "Update 1" ) )
998
+ . then < void > ( ( updatePath : string ) => {
999
+ ServerUtil . updatePackagePath = updatePath ;
1000
+ projectManager . runApplication ( TestConfig . testRunDirectory , targetPlatform ) ;
1001
+ return ServerUtil . expectTestMessages ( [
1002
+ ServerUtil . TestMessage . CHECK_UPDATE_AVAILABLE ,
1003
+ ServerUtil . TestMessage . DOWNLOAD_SUCCEEDED ,
1004
+ ServerUtil . TestMessage . UPDATE_INSTALLED ,
1005
+ ServerUtil . TestMessage . DEVICE_READY_AFTER_UPDATE ] ) ;
1006
+ } )
1007
+ . done ( ( ) => { done ( ) ; } , ( e ) => { done ( e ) ; } ) ;
1008
+ } ) ;
1009
+
1010
+ TestBuilder . it ( "doesn't block when the restart is ignored" , false ,
1011
+ ( done : MochaDone ) => {
1012
+ ServerUtil . updateResponse = { updateInfo : ServerUtil . createUpdateResponse ( false , targetPlatform ) } ;
1013
+ setupTestRunScenario ( projectManager , targetPlatform , ScenarioRestart2x )
1014
+ . then ( setupUpdateScenario . bind ( this , projectManager , targetPlatform , UpdateDeviceReady , "Update 1" ) )
1015
+ . then < void > ( ( updatePath : string ) => {
1016
+ ServerUtil . updatePackagePath = updatePath ;
1017
+ projectManager . runApplication ( TestConfig . testRunDirectory , targetPlatform ) ;
1018
+ return ServerUtil . expectTestMessages ( [
1019
+ ServerUtil . TestMessage . CHECK_UPDATE_AVAILABLE ,
1020
+ ServerUtil . TestMessage . DOWNLOAD_SUCCEEDED ,
1021
+ ServerUtil . TestMessage . UPDATE_INSTALLED ,
1022
+ ServerUtil . TestMessage . DEVICE_READY_AFTER_UPDATE ] ) ;
1023
+ } )
1024
+ . done ( ( ) => { done ( ) ; } , ( e ) => { done ( e ) ; } ) ;
1025
+ } ) ;
1026
+ } ) ;
1027
+
989
1028
TestBuilder . describe ( "#window.codePush.sync" ,
990
1029
( ) => {
991
1030
// We test the functionality with sync twice--first, with sync only called once,
0 commit comments