forked from infinitered/ignite-webview
-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.js
31 lines (24 loc) · 840 Bytes
/
test.js
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
/**
* Super simple testing. 1
*/
const NPM_NAME = "react-native-webview";
const { add, remove } = require("./plugin.js");
const assert = console.assert;
assert(typeof add === "function", "Plugin should export an `add` function");
assert(typeof remove === "function", "Plugin should export a `remove` fn");
const mockedContext = {
ignite: {
addModule: async (modName, options) => {
// prettier-ignore
assert(modName === NPM_NAME, `Wrong NPM name in add function: ${modName}`);
},
removeModule: async (modName, options) => {
// prettier-ignore
assert(modName === NPM_NAME, `Wrong NPM name in remove function: ${modName}`);
}
}
};
// Test the functions with mocked context
add(mockedContext).then(() => {});
remove(mockedContext).then(() => {});
console.info("Tests passed successfully.");