-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.test.js
33 lines (26 loc) · 860 Bytes
/
index.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
32
33
const Cyberoam = require(".");
const defaults = require("./defaults.json");
test("checks if options are set to defaults correctly", () => {
const cyberoam = new Cyberoam();
expect(cyberoam.options).toEqual(defaults);
});
test("checks if defaults are overriden properly", () => {
const newOpts = {
loginURL: "A",
liveURL: "B",
loginMessage: "C",
logoutMessage: "D",
commonOptions: { alpha: "beta" },
};
const cyberoam = new Cyberoam(newOpts);
expect(cyberoam.options).toEqual(newOpts);
});
test("checks if defaults are left unchanged when no alternative is provided", () => {
const newOpts = {
loginURL: "A",
};
const cyberoam = new Cyberoam(newOpts);
const { loginURL: a, ...toBeChecked } = cyberoam.options;
const { loginURL: b, ...newDefaults } = defaults;
expect(toBeChecked).toEqual(newDefaults);
});