feat(stats): add v1 immersion stats dashboard (#19)

This commit is contained in:
2026-03-20 02:43:28 -07:00
committed by GitHub
parent 42abdd1268
commit 6749ff843c
555 changed files with 46356 additions and 2553 deletions
+20
View File
@@ -0,0 +1,20 @@
import assert from 'node:assert/strict';
import fs from 'node:fs';
import test from 'node:test';
import { fileURLToPath } from 'node:url';
import { toErrorMessage } from './useSessions';
const USE_SESSIONS_PATH = fileURLToPath(new URL('./useSessions.ts', import.meta.url));
test('toErrorMessage normalizes Error and non-Error rejections', () => {
assert.equal(toErrorMessage(new Error('network down')), 'network down');
assert.equal(toErrorMessage('bad gateway'), 'bad gateway');
assert.equal(toErrorMessage(503), '503');
});
test('useSessions and useSessionDetail route catch handlers through toErrorMessage', () => {
const source = fs.readFileSync(USE_SESSIONS_PATH, 'utf8');
const matches = source.match(/setError\(toErrorMessage\(err\)\)/g);
assert.equal(matches?.length, 2);
});