mirror of
https://github.com/Shik3i/KoalaSync.git
synced 2026-07-26 12:08:15 +00:00
28 lines
753 B
JavaScript
28 lines
753 B
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs';
|
|
import path from 'node:path';
|
|
import { cwd } from 'node:process';
|
|
|
|
const popupPath = path.join(cwd(), 'extension', 'popup.js');
|
|
const source = fs.readFileSync(popupPath, 'utf8');
|
|
|
|
assert.match(
|
|
source,
|
|
/const ROOM_LIST_REFRESH_COOLDOWN_MS\s*=\s*11000;/,
|
|
'popup should define an 11 second room-list refresh cooldown'
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/elements\.refreshRooms\.disabled\s*=\s*true;/,
|
|
'refresh button should be disabled while cooldown is active'
|
|
);
|
|
|
|
assert.match(
|
|
source,
|
|
/setTimeout\(\(\)\s*=>\s*{\s*elements\.refreshRooms\.disabled\s*=\s*false;/s,
|
|
'refresh button should be re-enabled after the cooldown'
|
|
);
|
|
|
|
console.log('popup refresh cooldown tests passed');
|