forked from microsoft/react-native-code-push
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSamePackageTest.js
More file actions
31 lines (27 loc) · 1.18 KB
/
SamePackageTest.js
File metadata and controls
31 lines (27 loc) · 1.18 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
"use strict";
import React from "react-native";
import CodePush from "react-native-code-push";
import createTestCaseComponent from "../../utils/createTestCaseComponent";
import assert from "assert";
import createMockAcquisitionSdk from "../../utils/mockAcquisitionSdk";
import { serverPackage } from "../resources/testPackages";
const NativeCodePush = React.NativeModules.CodePush;
const PackageMixins = require("react-native-code-push/package-mixins.js")(NativeCodePush);
const localPackage = serverPackage;
let SamePackageTest = createTestCaseComponent(
"SamePackageTest",
"should not return an update when the server's version is the same as the local version",
() => {
let mockAcquisitionSdk = createMockAcquisitionSdk(serverPackage, localPackage);
let mockConfiguration = { appVersion : "1.5.0" };
CodePush.setUpTestDependencies(mockAcquisitionSdk, mockConfiguration, NativeCodePush);
CodePush.getCurrentPackage = async () => {
return localPackage;
};
},
async () => {
let update = await CodePush.checkForUpdate();
assert(!update, "checkForUpdate should not return a package when local package is identical");
}
);
module.exports = SamePackageTest;