docs: define presentation rehearsal route matrix
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import rehearsalRoutes from "../../../../../scripts/presentation-rehearsal-routes.json";
|
||||
import {
|
||||
hashForLocation,
|
||||
locationFromHash,
|
||||
nextMainLocation,
|
||||
previousMainLocation,
|
||||
} from "./storyboard-navigation.js";
|
||||
import { defaultMainLocation, type MainLocation } from "./storyboard.js";
|
||||
import { defaultMainLocation, mainScenes, type MainLocation } from "./storyboard.js";
|
||||
|
||||
describe("storyboard navigation", () => {
|
||||
it("round-trips main and discussion hashes", () => {
|
||||
@@ -23,6 +24,59 @@ describe("storyboard navigation", () => {
|
||||
.toBe("#discuss/where-is-ai-agent");
|
||||
});
|
||||
|
||||
it("covers every current storyboard beat with one canonical rehearsal route", () => {
|
||||
const storyboardRoutes = mainScenes.flatMap((scene) =>
|
||||
scene.beats.map((beat) => `${scene.id}/${beat.id}`),
|
||||
);
|
||||
const manifestRoutes = rehearsalRoutes.map((route) => `${route.sceneId}/${route.beatId}`);
|
||||
|
||||
expect(new Set(manifestRoutes).size).toBe(manifestRoutes.length);
|
||||
expect(manifestRoutes).toHaveLength(storyboardRoutes.length);
|
||||
|
||||
for (const scene of mainScenes) {
|
||||
for (const beat of scene.beats) {
|
||||
const matchingRoutes = rehearsalRoutes.filter(
|
||||
(route) => route.sceneId === scene.id && route.beatId === beat.id,
|
||||
);
|
||||
expect(matchingRoutes, `missing rehearsal route for scene ${scene.id}`).toHaveLength(1);
|
||||
const route = matchingRoutes[0];
|
||||
if (!route) continue;
|
||||
expect(route).toMatchObject({
|
||||
sceneId: scene.id,
|
||||
beatId: beat.id,
|
||||
route: `${scene.id}/${beat.id}`,
|
||||
});
|
||||
expect(locationFromHash(hashForLocation({
|
||||
kind: "main",
|
||||
sceneId: scene.id,
|
||||
beatId: beat.id,
|
||||
focusPath: [],
|
||||
}))).toEqual({
|
||||
kind: "main",
|
||||
sceneId: scene.id,
|
||||
beatId: beat.id,
|
||||
focusPath: [],
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
for (const route of rehearsalRoutes) {
|
||||
expect(Object.keys(route).sort()).toEqual(["beatId", "fileStem", "route", "sceneId"]);
|
||||
expect(storyboardRoutes).toContain(`${route.sceneId}/${route.beatId}`);
|
||||
expect(locationFromHash(hashForLocation({
|
||||
kind: "main",
|
||||
sceneId: route.sceneId as MainLocation["sceneId"],
|
||||
beatId: route.beatId,
|
||||
focusPath: [],
|
||||
}))).toMatchObject({
|
||||
kind: "main",
|
||||
sceneId: route.sceneId,
|
||||
beatId: route.beatId,
|
||||
focusPath: [],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
it("parses the Questions beat location", () => {
|
||||
expect(locationFromHash("#scene/conclusion/questions")).toEqual({
|
||||
kind: "main",
|
||||
|
||||
Reference in New Issue
Block a user