fix: remove embedded dashboard snapshot
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -1,5 +1,6 @@
|
|||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
|
import { readFileSync } from 'node:fs';
|
||||||
import { safeFetch, safeFetchText, getFetchMetrics } from '../apis/utils/fetch.mjs';
|
import { safeFetch, safeFetchText, getFetchMetrics } from '../apis/utils/fetch.mjs';
|
||||||
|
|
||||||
test('safeFetch reports HTML as degraded JSON response', async () => {
|
test('safeFetch reports HTML as degraded JSON response', async () => {
|
||||||
@@ -34,3 +35,21 @@ test('safeFetchText returns text and byte count', async () => {
|
|||||||
globalThis.fetch = originalFetch;
|
globalThis.fetch = originalFetch;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('server dashboard shell does not embed an operational snapshot', () => {
|
||||||
|
const html = readFileSync(new URL('../dashboard/public/jarvis.html', import.meta.url), 'utf8');
|
||||||
|
assert.match(html, /let D = createDashboardShellData\(\);/);
|
||||||
|
assert.doesNotMatch(html, /2026-04-03T16:18:10\.188Z/);
|
||||||
|
assert.doesNotMatch(html, /Trump announced new strikes on Iran/);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('server dashboard fetches api data before initialization', () => {
|
||||||
|
const html = readFileSync(new URL('../dashboard/public/jarvis.html', import.meta.url), 'utf8');
|
||||||
|
const serverMode = html.indexOf('if (canProbeApi)');
|
||||||
|
const apiFetch = html.indexOf("fetch('/api/data')");
|
||||||
|
const firstInitAfterServerMode = html.indexOf('init();', serverMode);
|
||||||
|
|
||||||
|
assert.ok(serverMode > -1);
|
||||||
|
assert.ok(apiFetch > serverMode);
|
||||||
|
assert.ok(firstInitAfterServerMode > apiFetch);
|
||||||
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user