testLayoutStepsReachThisLayout

tcmts.store.test.testLayoutStepsReachThisLayout · #bkmqhhn6 · term

Every layout a step moves on from leads, step by step, to this tcm's (LAYOUT), and none moves on from it.

import { LAYOUT, LAYOUT_STEPS } from "#codebase/tcmts/store";
import assert from "node:assert/strict";

export const testLayoutStepsReachThisLayout = () => {
  for (const from of Object.keys(LAYOUT_STEPS)) {
    const seen = new Set<string>();
    for (let at = from; at !== LAYOUT; at = LAYOUT_STEPS[at]!.to) {
      assert.ok(LAYOUT_STEPS[at] && !seen.has(at), `layout ${from} leads nowhere, at ${at}`);
      seen.add(at);
    }
  }
  assert.equal(LAYOUT_STEPS[LAYOUT], undefined);
}

uses