spa modules and terminology: app.mjs split into flat es modules (router lifecycle, shared widgets, views own their state), mock smoke in test/; DICTIONARY.md rules the terms, four renames swept clean through the machinery - paper->status (run summary command is report now), window->session, wrap->housekeeping, context window->contwin; no dual-accepts by ruling, old data migrates once in the clerk (restore self-heals old dumps)
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
// test/restart-check.mjs — after a server restart: the token
|
||||
// survives, the boot-rebuild reopened the unhousekept sessions, the
|
||||
// runs list is whole. Reads the token + run ids smoke.mjs left in
|
||||
// the temp file; run against the restarted --mock server:
|
||||
// node test/restart-check.mjs
|
||||
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { join } from 'node:path';
|
||||
import { tmpdir } from 'node:os';
|
||||
|
||||
const BASE = process.env.RP_BASE ?? 'http://127.0.0.1:7350';
|
||||
const [token, reforkId, secondId] = readFileSync(join(tmpdir(), 'rp-test-smoke-token.txt'), 'utf8').trim().split(' ');
|
||||
const call = async (path, tok) => {
|
||||
const res = await fetch(`${BASE}/api${path}`, {
|
||||
headers: tok ? { authorization: `Bearer ${tok}` } : {},
|
||||
});
|
||||
return { status: res.status, data: await res.json().catch(() => ({})) };
|
||||
};
|
||||
let failures = 0;
|
||||
const ok = (name, cond, extra = '') => {
|
||||
console.log(`${cond ? 'PASS' : 'FAIL'} ${name}${extra ? ` — ${extra}` : ''}`);
|
||||
if (!cond) failures++;
|
||||
};
|
||||
|
||||
let r = await call('/session', token);
|
||||
ok('token survives restart', r.status === 200 && r.data.user?.name === 'Op');
|
||||
|
||||
r = await call(`/runs/${reforkId}`, token);
|
||||
ok('forked session rebuilt', r.status === 200 && r.data.open === true, JSON.stringify({ open: r.data.open, owner: r.data.run.owner }));
|
||||
|
||||
r = await call(`/runs/${secondId}`, token);
|
||||
ok('draft intact', r.status === 200 && r.data.draft === true);
|
||||
|
||||
r = await call('/runs', token);
|
||||
ok('runs listed', r.status === 200 && Array.isArray(r.data) && r.data.length >= 4, `${r.data.length} runs`);
|
||||
|
||||
console.log(failures ? `\n${failures} FAILURES` : '\nALL PASS');
|
||||
process.exit(failures ? 1 : 0);
|
||||
Reference in New Issue
Block a user