Files
react-native-code-push/Examples/CodePushDemoApp/CodePushDemoAppTests/InstallUpdateTests/testcases/NotifyApplicationReadyTest.js
Geoffrey Goh bc52e8f0c5 add tests
2015-12-18 00:08:11 -08:00

44 lines
1.7 KiB
JavaScript

"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 NotifyApplicationReadyTest = createTestCaseComponent(
"NotifyApplicationReadyTest",
"After an update, the app should remain using the installed version after multiple restarts if \"notifyApplicationReady\" is called.",
() => {
if (Platform.OS === "android") {
remotePackage.downloadUrl = "http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/NotifyApplicationReadyAndRestart.includeRequire.runModule.bundle?platform=android&dev=true"
} else if (Platform.OS === "ios") {
remotePackage.downloadUrl = "http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/NotifyApplicationReadyAndRestart.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("NotifyApplicationReadyTest", () => NotifyApplicationReadyTest);