Skip to content

Turn any idea, plan, or codebase into a beautiful interactive diagram. An agent skill for Claude Code, Codex, and more.

test(viewer): isolate route animation completion from fallback

sunsunsun16b2ca55ef61
diff --git a/archify/test/route-probe-browser.test.mjs b/archify/test/route-probe-browser.test.mjs
index 2438ba26..1d5929dc 100644
--- a/archify/test/route-probe-browser.test.mjs
+++ b/archify/test/route-probe-browser.test.mjs
@@ -225,7 +225,17 @@ test('Route Probe preserves directed paths, Journey and export contracts', {
const fallback = await run(`routeClock(({last,fire})=>{Archify.routeProbe.selectJourneyIndex(1);const before=!!document.querySelector('[data-route-journey-overlay]');fire(last(860));return {before,after:!!document.querySelector('[data-route-journey-overlay]'),result:Archify.routeProbe.result()};})`);
assert.equal(fallback.before, true); assert.equal(fallback.after, false); assert.equal(fallback.result.journey, 1);
records.push({ scenario: 'pulse-fixture', pulses, fallback });
- await run('Archify.routeProbe.selectJourneyIndex(2)');
+ await run(`
+ routeEnds.length = 0;
+ // Hold cleanup timers while checking the independent, real animationend path.
+ // The fallback and stale callbacks are exercised above with the same clock.
+ routeClock(() => {
+ Archify.routeProbe.selectJourneyIndex(2);
+ // A busy first frame must not make this assertion race the 860ms fallback.
+ const until = performance.now() + 350;
+ while (performance.now() < until) {}
+ });
+ `);
await run(`routeWait(()=>routeEnds.some(e=>e.trusted&&e.name==='archify-route-journey-flow'))`);
await run(`routeWait(()=>!document.querySelector('[data-route-journey-overlay]'))`);
assert.equal((await snapshot('real-animation-complete')).result.journey, 2);