forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInstallModeImmediateTest.js
More file actions
44 lines (39 loc) · 1.65 KB
/
InstallModeImmediateTest.js
File metadata and controls
44 lines (39 loc) · 1.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
"use strict";
var React = require("react-native");
var { DeviceEventEmitter, Platform, AppRegistry } = require("react-native");
var CodePush = require("react-native-code-push");
var NativeCodePush = React.NativeModules.CodePush;
var createTestCaseComponent = require("../../utils/createTestCaseComponent");
var PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
var assert = require("assert");
var remotePackage = {
description: "Angry flappy birds",
appVersion: "1.5.0",
label: "2.4.0",
isMandatory: false,
isAvailable: true,
updateAppVersion: false,
packageHash: "hash240",
packageSize: 1024
};
var InstallModeImmediateTest = createTestCaseComponent(
"InstallModeImmediateTest",
"App should restart immediately to the new version after it is installed",
() => {
if (Platform.OS === "android") {
remotePackage.downloadUrl = "http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassInstallModeImmediateTest.includeRequire.runModule.bundle?platform=android&dev=true"
} else if (Platform.OS === "ios") {
remotePackage.downloadUrl = "http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/PassInstallModeImmediateTest.includeRequire.runModule.bundle?platform=ios&dev=true"
}
remotePackage = Object.assign(remotePackage, PackageMixins.remote);
return Promise.resolve();
},
() => {
remotePackage.download()
.then((localPackage) => {
return localPackage.install(NativeCodePush.codePushInstallModeImmediate);
});
},
/*passAfterRun*/ false
);
AppRegistry.registerComponent("InstallModeImmediateTest", () => InstallModeImmediateTest);