Skip to content
This repository was archived by the owner on May 20, 2025. It is now read-only.

Commit 7e5ac6b

Browse files
author
scottbommarito
committed
another test case
1 parent d57278b commit 7e5ac6b

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import CodePush from "react-native-code-push";
2+
3+
module.exports = {
4+
startTest: function(testApp) {
5+
CodePush.restartApp(true);
6+
CodePushWrapper.checkAndInstall(testApp,
7+
() => {
8+
CodePush.restartApp(true);
9+
}
10+
);
11+
},
12+
13+
getScenarioName: function() {
14+
return "Restart2x";
15+
}
16+
};

test/test.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,7 @@ const ScenarioSyncResumeDelay = "scenarioSyncResumeDelay.js";
472472
const ScenarioSyncRestartDelay = "scenarioSyncResumeDelay.js";
473473
const ScenarioSync2x = "scenarioSync2x.js";
474474
const ScenarioRestart = "scenarioRestart.js";
475+
const ScenarioRestart2x = "scenarioRestart2x.js";
475476
const ScenarioSyncMandatoryDefault = "scenarioSyncMandatoryDefault.js";
476477
const ScenarioSyncMandatoryResume = "scenarioSyncMandatoryResume.js";
477478
const ScenarioSyncMandatoryRestart = "scenarioSyncMandatoryRestart.js";
@@ -989,11 +990,28 @@ PluginTestingFramework.initializeTests(new RNProjectManager(), supportedTargetPl
989990

990991
TestBuilder.describe("#codePush.restartApplication.2x",
991992
() => {
992-
TestBuilder.it("with pending update", false,
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, "Good Update"))
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,
9931011
(done: MochaDone) => {
9941012
ServerUtil.updateResponse = { updateInfo: ServerUtil.createUpdateResponse(false, targetPlatform) };
995-
996-
setupUpdateScenario(projectManager, targetPlatform, UpdateDeviceReady, "Update 1")
1013+
setupTestRunScenario(projectManager, targetPlatform, ScenarioRestart2x)
1014+
.then(setupUpdateScenario.bind(this, projectManager, targetPlatform, UpdateDeviceReady, "Good Update"))
9971015
.then<void>((updatePath: string) => {
9981016
ServerUtil.updatePackagePath = updatePath;
9991017
projectManager.runApplication(TestConfig.testRunDirectory, targetPlatform);
@@ -1005,7 +1023,7 @@ PluginTestingFramework.initializeTests(new RNProjectManager(), supportedTargetPl
10051023
})
10061024
.done(() => { done(); }, (e) => { done(e); });
10071025
});
1008-
}, ScenarioInstallRestart2x);
1026+
});
10091027

10101028
TestBuilder.describe("#window.codePush.sync",
10111029
() => {

0 commit comments

Comments
 (0)