mirror of
https://github.com/zhigang1992/react-native-code-push.git
synced 2026-06-10 23:59:42 +08:00
44 lines
1.6 KiB
JavaScript
44 lines
1.6 KiB
JavaScript
"use strict";
|
|
|
|
import React from "react-native";
|
|
let { DeviceEventEmitter, Platform, AppRegistry } = require("react-native");
|
|
import CodePush from "react-native-code-push";
|
|
let NativeCodePush = React.NativeModules.CodePush;
|
|
import createTestCaseComponent from "../../utils/createTestCaseComponent";
|
|
let PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
|
|
import assert from "assert";
|
|
|
|
let remotePackage = {
|
|
description: "Angry flappy birds",
|
|
appVersion: "1.5.0",
|
|
label: "2.4.0",
|
|
isMandatory: false,
|
|
isAvailable: true,
|
|
updateAppVersion: false,
|
|
packageHash: "hash240",
|
|
packageSize: 1024
|
|
};
|
|
|
|
let RollbackTest = createTestCaseComponent(
|
|
"RollbackTest",
|
|
"should successfully rollback if \"notifyApplicationReady\" is not called in the installed package.",
|
|
() => {
|
|
if (Platform.OS === "android") {
|
|
remotePackage.downloadUrl = "http://10.0.3.2:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1.includeRequire.runModule.bundle?platform=android&dev=true"
|
|
} else if (Platform.OS === "ios") {
|
|
remotePackage.downloadUrl = "http://localhost:8081/CodePushDemoAppTests/InstallUpdateTests/resources/RollbackTestBundleV1.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("RollbackTest", () => RollbackTest); |