forked from mm7894215/TokenTracker
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdashboard-link-code-expiry.test.js
More file actions
23 lines (20 loc) · 1.05 KB
/
Copy pathdashboard-link-code-expiry.test.js
File metadata and controls
23 lines (20 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
const path = require("node:path");
const pagePath = path.join(__dirname, "..", "dashboard", "src", "pages", "DashboardPage.jsx");
function readFile(filePath) {
return fs.readFileSync(filePath, "utf8");
}
test("DashboardPage schedules link code expiry tick", () => {
const src = readFile(pagePath);
assert.ok(src.includes("linkCodeExpiryTick"), "expected link code expiry tick state");
assert.ok(src.includes("setLinkCodeExpiryTick"), "expected link code expiry tick updater");
assert.ok(src.includes("linkCodeRefreshToken"), "expected link code refresh trigger state");
assert.ok(src.includes("setLinkCodeRefreshToken"), "expected link code refresh trigger updater");
assert.ok(
src.includes("setTimeout") || src.includes("setTimeout(") || src.includes("setTimeout ("),
"expected expiry timer to re-evaluate link code expiration",
);
assert.ok(src.includes("visibilitychange"), "expected expiry refresh on visibility change");
});