Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 9afec77e76e0aea638dca560cd3100ffd0a39c0e
parent 3800299ac747bb0a289c1d30d5c8a3347e1352a9
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Thu, 29 Oct 2026 00:39:06 -0400

umtool: layer preview tests -- composed alone, a window per window, the files route's names

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Aumtool/lib/report/layerPreview.test.mjs | 53+++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 53 insertions(+), 0 deletions(-)

diff --git a/umtool/lib/report/layerPreview.test.mjs b/umtool/lib/report/layerPreview.test.mjs @@ -0,0 +1,53 @@ +// The module panel's single-layer preview: composeLayerPreviews (onscreen.mjs) +// and the files route's layer names (serve.mjs layerPreviewOf). +import { test } from "node:test"; +import assert from "node:assert/strict"; +import path from "node:path"; + +import { composeLayerPreviews } from "./onscreen.mjs"; +import { layerPreviewOf, layerPreviewSrc, previewDirFor } from "./serve.mjs"; + +const palette = { bg: "#000000", fg: "#ffffff", muted: "#888888", accent: "#ff0000" }; +const render = { + width: 1920, height: 1080, fps: 30, palette, + chrome: { + engine: "hyperframes", layout: "deck", + pair: { pairs: [{ then: { clip: "a", date: "2012" }, now: { clip: "b", date: "2026" } }] }, + chapter: { list: [{ at: "b", title: "Two" }] }, + }, +}; +const schedule = { + kind: "deck", fps: 30, total: 20, transition: 0.5, + segments: [["a", 0, 10], ["b", 10, 20]].map(([id, start, end]) => ({ id, type: "clip", start, end, duration: end - start })), +}; + +test("each layer composed alone: a whole page once, a window page per window, a part as the deck's, an absent one off", async () => { + const calls = []; + const compose = async (args) => { + calls.push(args); + const name = args.region === "chapter" ? `chapter-preview-${args.segment}` : `${args.region}-preview`; + return { projDir: path.join("/p/out/sourced/chrome", name) }; + }; + const out = await composeLayerPreviews({ dir: "/p", manifestFile: "/p/video.manifest.json" }, "sourced", schedule, ["pair", "chapter", "counter", "status", "nope"], render, { compose }); + const by = Object.fromEntries(out.map((l) => [l.id, l])); + assert.equal(by.pair.name, "pair-preview"); + assert.equal(by.pair.geometry.width > 0, true); + assert.deepEqual(by.chapter.windows.map((w) => [w.segment, w.from, w.name]), [["b", 10, "chapter-preview-b"]]); + assert.equal(by.counter.region, "deck"); + assert.match(by.status.off, /status/); + assert.match(by.nope.error, /no module/); + assert.deepEqual(calls.map((c) => [c.region, c.preview, c.segment ?? null]), [["pair", true, null], ["chapter", true, "b"]]); + assert.ok(calls.every((c) => c.schedule === schedule && c.manifestPath === "/p/video.manifest.json")); +}); + +test("the files route serves a layer's project by its name, a window's only for the cut's own entry", () => { + assert.equal(layerPreviewOf("pair-preview"), "pair-preview"); + assert.equal(layerPreviewOf("chapter-preview-b", ["a", "b"]), "chapter-preview-b"); + assert.equal(layerPreviewOf("chapter-preview-zz", ["a", "b"]), null); + assert.equal(layerPreviewOf("chapter-preview-..", [".."]), null); + assert.equal(layerPreviewOf("deck-preview"), null); + assert.deepEqual(previewDirFor("/p", "sourced", ["status-preview", "index.html"], []), { dir: "/p/out/sourced/chrome/status-preview", rest: ["index.html"] }); + // The deck's own preview, as it always was. + assert.equal(previewDirFor("/p", "sourced", ["index.html"], []).dir, "/p/out/sourced/chrome/deck-preview"); + assert.equal(layerPreviewSrc("reports/x", "sourced", "pair-preview"), "/api/report/chrome/files/" + layerPreviewSrc("reports/x", "sourced", "pair-preview").split("/api/report/chrome/files/")[1]); +});