-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
54 lines (46 loc) · 1.57 KB
/
index.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
47
48
49
50
51
52
53
54
require("dotenv").config();
const assert = require("assert");
const {
bulkFlatCheck,
graphFilterCheck,
singleCheck,
} = require("./lib/checks");
const {
flatSync,
graphSync,
clearAllInstances,
syncRego,
syncUser,
allowedVisitConditionSet,
} = require("./lib/sync");
const sleep = async (ms) => new Promise((resolve) => setTimeout(resolve, ms));
(async () => {
await syncUser();
await syncRego("reset");
await clearAllInstances();
await flatSync();
await sleep(10000);
const flatFilterResult = await bulkFlatCheck();
console.log("Flat filter result: ", JSON.stringify(flatFilterResult));
assert.deepEqual(flatFilterResult, [true, false, false, false, true, true]);
await clearAllInstances();
await graphSync();
await sleep(10000);
const graphFilterResult = await graphFilterCheck();
console.log("Graph filter result: ", JSON.stringify(graphFilterResult));
assert.deepEqual(graphFilterResult, [true, false, false, false, true, true]);
await syncRego("custom");
await clearAllInstances();
await flatSync();
await sleep(10000);
const customRegoResult = await singleCheck();
console.log("Custom rego check result: ", JSON.stringify(customRegoResult));
assert.deepEqual(customRegoResult, [true, false, false, false, true, true]);
await clearAllInstances();
await allowedVisitConditionSet();
await flatSync();
await sleep(10000);
const singleCheckResult = await singleCheck();
console.log("Single check result: ", JSON.stringify(singleCheckResult));
assert.deepEqual(singleCheckResult, [true, false, false, false, true, true]);
})();