commit
e092cb029c
252 files changed
+35037
No files matched your search
@@ -0,0 +1,26 @@
|
||||
// SPDX-FileCopyrightText: 2026 Scientific Computing Studio, LLC
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
// Runs against the compiled output: `npm test` builds first.
|
||||
import test from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import { PROBLEMS, stateForProblem } from '../dist/core/catalog.js';
|
||||
import { Session } from '../dist/core/session.js';
|
||||
import { encodeState, decodeState, parseRoute, routeFor } from '../dist/core/state.js';
|
||||
import { toAscii, toMath, parseSpec, weave, extractSpec } from '../core/dist/services/speco.js';
|
||||
import { studyOf, runPseudo, provePseudo } from '../core/dist/services/pseudo.js';
|
||||
import { readLingo, runLingo } from '../core/dist/services/lingo.js';
|
||||
import { parseAsm, runAsmProgram, parseSetup } from '../core/dist/services/asm.js';
|
||||
|
||||
globalThis.localStorage = { getItem() { return null; }, setItem() { }, removeItem() { } };
|
||||
|
||||
test('state survives a URL round trip and routes parse', async () => {
|
||||
const st = stateForProblem(PROBLEMS[0]); st.t = 7; st.call = 'COUNT_BASE(\'G\', "GGG")';
|
||||
const back = await decodeState(await encodeState(st));
|
||||
assert.deepEqual(back.sources, st.sources);
|
||||
assert.equal(back.t, 7); assert.equal(back.call, st.call); assert.equal(back.problem, st.problem);
|
||||
assert.deepEqual(parseRoute('#/bridge/p/count-base'), { kind: 'problem', area: 'bridge', id: 'count-base' });
|
||||
const r = parseRoute('#/embed/trace/p/match?t=12');
|
||||
assert.equal(r.kind, 'embed'); assert.equal(r.view, 'trace'); assert.equal(r.problem, 'match'); assert.equal(r.params.get('t'), '12');
|
||||
assert.equal(routeFor({ kind: 'problem', area: 'dev', id: 'match' }), '#/dev/p/match');
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user