-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main-tests.js
46 lines (35 loc) · 1.13 KB
/
main-tests.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
34
35
36
37
38
39
40
41
42
43
44
45
46
const { throws, deepEqual } = require('assert');
const mod = require('./main.js');
describe('OLSKFiguresEndpointURL', function test_OLSKFiguresEndpointURL () {
it('returns string', function () {
deepEqual(mod.OLSKFiguresEndpointURL(), 'https://old-fire-5813.dash-cloudflare-com7350.workers.dev/js/script.js');
});
});
describe('DOMContentLoaded', function test_DOMContentLoaded() {
const _DOMContentLoaded = function (inputData = {}) {
return Object.assign(Object.assign({}, mod), {
OLSKFiguresLoad: (function () {}),
}, inputData).DOMContentLoaded();
};
it('calls OLSKFiguresLoad', async function () {
const item = Math.random().toString();
deepEqual(await uCapture(function (capture) {
_DOMContentLoaded({
OLSKFiguresLoad () {
return capture(item);
},
});
}), [item]);
});
});
describe('LifecycleModuleDidLoad', function test_LifecycleModuleDidLoad() {
it('listens for DOMContentLoaded', function () {
deepEqual(uCapture(function (addEventListener) {
mod.LifecycleModuleDidLoad({
document: {
addEventListener,
},
});
}), ['DOMContentLoaded', mod.DOMContentLoaded]);
});
});