testHeadCacheFollowsTheHead
What the pages keep for the branch's head is made again when the head moves, and kept while it stays.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { namesNow, shareCache } from "#codebase/tcmts/share"; import { storyStore } from "#codebase/tcmts/share/test"; import assert from "node:assert/strict"; export const testHeadCacheFollowsTheHead = () => { const { store } = storyStore(); const s = { cb: { store } as unknown as Codebase, cache: shareCache() }; const before = namesNow(s); assert.equal(namesNow(s), before, "kept while the head stays"); assert.equal( s.cache.atHead(s.cb, "names", () => []), before, ); store.addName("lib.f", "e1", "term", "add"); store.endBatch(); const after = namesNow(s); assert.notEqual(after, before); assert.ok(after.some((r) => r.path === "lib.f") && !before.some((r) => r.path === "lib.f")); }