testTextVersionNamespacesArePinned
A namespace node naming a text version is written with a fourth list, and hashed with it; one naming none is as
before there were text versions (testNamespaceAndCausalHashesArePinned).
import { a, b, open } from "#codebase/tcmts/store/test/history"; import assert from "node:assert/strict"; export const testTextVersionNamespacesArePinned = () => { const s = open(); const ns = s.namespaceOf([ { path: "lib.square", hash: a, text: "t".repeat(52) }, { path: "lib.util.Point", hash: b }, { path: "main", hash: b }, ]); assert.equal( ns, s.namespaceOf([ { path: "main", hash: b }, { path: "lib.util.Point", hash: b }, { path: "lib.square", hash: a, text: "t".repeat(52) }, ]), ); assert.equal(ns, "m5xytocpvok4cj5to6eghc52zjcabskgp736gvqziyhercpoaq6a"); assert.deepEqual( s.namespaceRows(ns).map((r) => `${r.path} ${r.hash[0]} ${r.text?.[0] ?? "-"}`), ["lib.square a t", "lib.util.Point b -", "main b -"], ); assert.deepEqual([...s.textsAt(ns)], [[a, "t".repeat(52)]]); }