various fixes. added version#s and added a playable browser build of the solitaire game (including deploy to filebrowser script)

This commit is contained in:
Jesse
2026-07-31 22:03:13 -04:00
parent 160190da3f
commit 2eca9de09f
16 changed files with 2399 additions and 401 deletions
+24
View File
@@ -268,6 +268,30 @@ describe('replay HTML', () => {
}
});
it('renders a LATER frame, where the board state is carried forward', () => {
// The page omits cells/facilities/division when unchanged and resolves them by walking back —
// 63% of a 5.2 MB payload was the same grid re-serialised every frame. Rendering only frame 0
// would never exercise that path, because frame 0 always carries everything.
const js = html.slice(html.lastIndexOf('<script>') + 8, html.lastIndexOf('</script>'));
const els = new Map<string, Record<string, unknown>>();
const stub = {
getElementById: (id: string) => {
if (!els.has(id)) els.set(id, { textContent: '', innerHTML: '', value: '', style: {}, max: 0 });
return els.get(id);
},
};
// Append a jump to a late frame so render() runs against carried-forward state.
const run = new Function('document', 'setInterval', 'clearInterval', js + '\n;go(FRAMES.length - 1);');
assert.doesNotThrow(
() => run(stub, () => 0, () => undefined),
'the page threw rendering a frame whose board state was carried forward',
);
assert.ok(
String(els.get('grid')?.innerHTML ?? '').length > 0,
'the grid rendered empty on a carried-forward frame',
);
});
it('stays a sane size', () => {
const mb = Buffer.byteLength(html) / 1024 / 1024;
assert.ok(mb < 5, `replay is ${mb.toFixed(1)} MB`);