The ONE co-located guard a versioned app writes — it runs BOTH checks so a single
test proves the versioning is consistent end to end:
assertVersionsMatchSchema — the history folds to the live schema, every
change is recorded, only real persisted schemas appear, handlers are single-quadrant
(schema/authoring coverage; throws synchronously with a fix recipe);
testUpgradeHandlers — every entry with a handler has a handlers case,
and each case runs against a store staged to the handler's input version and passes
(handler coverage + behavior; throws for a missing case, rejects for a failing run).
currentVersion is taken from database.version — so a bug wiring db.version to
something other than entries.length - 1 is caught too.
Returns the promise from step 2 — it("versioning", () => assertVersioning({ … })).
The two underlying functions stay exported for bespoke use.
The ONE co-located guard a versioned app writes — it runs BOTH checks so a single test proves the versioning is consistent end to end:
handlerhas ahandlerscase, and each case runs against a store staged to the handler's input version and passes (handler coverage + behavior; throws for a missing case, rejects for a failing run).currentVersionis taken fromdatabase.version— so a bug wiringdb.versionto something other thanentries.length - 1is caught too.Returns the promise from step 2 —
it("versioning", () => assertVersioning({ … })). The two underlying functions stay exported for bespoke use.