mirror of
https://github.com/jason5ng32/MyIP.git
synced 2026-11-04 08:55:47 +00:00
65 lines
1.5 KiB
JavaScript
65 lines
1.5 KiB
JavaScript
import assert from 'node:assert/strict';
|
|
import { describe, it } from 'node:test';
|
|
|
|
import {
|
|
SECTION_IDS,
|
|
createMountingStatus,
|
|
createLoadingStatus,
|
|
} from '../frontend/data/sections.js';
|
|
|
|
describe('SECTION_IDS', () => {
|
|
it('lists all 6 section DOM ids in render order', () => {
|
|
assert.deepEqual(SECTION_IDS, [
|
|
'IPInfo',
|
|
'Connectivity',
|
|
'WebRTC',
|
|
'DNSLeakTest',
|
|
'SpeedTest',
|
|
'AdvancedTools',
|
|
]);
|
|
});
|
|
|
|
});
|
|
|
|
describe('createMountingStatus()', () => {
|
|
it('returns all 6 section ids as mount keys, set to false', () => {
|
|
const s = createMountingStatus();
|
|
assert.deepEqual(s, {
|
|
IPInfo: false,
|
|
Connectivity: false,
|
|
DNSLeakTest: false,
|
|
WebRTC: false,
|
|
SpeedTest: false,
|
|
AdvancedTools: false,
|
|
});
|
|
});
|
|
|
|
it('returns a fresh object each call', () => {
|
|
const a = createMountingStatus();
|
|
const b = createMountingStatus();
|
|
assert.notEqual(a, b);
|
|
a.IPInfo = true;
|
|
assert.equal(b.IPInfo, false);
|
|
});
|
|
});
|
|
|
|
describe('createLoadingStatus()', () => {
|
|
it('returns the 4 loading section ids set to false (subset of mounting keys)', () => {
|
|
const s = createLoadingStatus();
|
|
assert.deepEqual(s, {
|
|
IPInfo: false,
|
|
Connectivity: false,
|
|
DNSLeakTest: false,
|
|
WebRTC: false,
|
|
});
|
|
});
|
|
|
|
it('returns a fresh object each call', () => {
|
|
const a = createLoadingStatus();
|
|
const b = createLoadingStatus();
|
|
assert.notEqual(a, b);
|
|
a.WebRTC = true;
|
|
assert.equal(b.WebRTC, false);
|
|
});
|
|
});
|