From 6e47710e814be6ab784ab1de46e4abf92863ffb4 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Wed, 30 Sep 2026 17:05:11 +0200 Subject: [PATCH] Test: catalog lookups by definition name their value type The catalogs' parse option went with asSchemaAlias, and with it the only thing that inferred a catalog lookup's value type. Three test reads now pass the note type explicitly, as a caller does. Co-Authored-By: Claude Opus 5.5 --- packages/cultmesh-ts/test/cultmesh.test.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/cultmesh-ts/test/cultmesh.test.ts b/packages/cultmesh-ts/test/cultmesh.test.ts index d2935da8..b6fee823 100644 --- a/packages/cultmesh-ts/test/cultmesh.test.ts +++ b/packages/cultmesh-ts/test/cultmesh.test.ts @@ -24,6 +24,8 @@ const noteDocument = defineDocumentType({ name: "noteId", }); +type Note = z.infer; + // Another type claiming noteDocument's schema. It is never registered beside noteDocument: one type owns a schema. const otherTypeForNoteSchema = defineDocumentType({ type: "cultmesh.note.ui", @@ -133,7 +135,7 @@ test("CultMesh TS document handles hide local cache plumbing behind typed reacti body: "catalog-updated", }); assert.equal( - (await catalog.latest(noteDocument, "browser-client")).body, + (await catalog.latest(noteDocument, "browser-client")).body, "catalog-updated", ); // A typed lookup is answered by its own type's handle; a handle of another type for the same schema is not it. @@ -939,7 +941,7 @@ test("CultMesh TS binds publication document catalogs from source resolvers", as ["daemon:first", "daemon:second"], ); assert.equal( - (await catalog.document(noteDocument).latest()).body, + (await catalog.document(noteDocument).latest()).body, "second source", ); assert.equal(catalog.document(noteDocument).routeHint.description, "publication catalog"); @@ -1115,7 +1117,7 @@ test("CultMesh TS collection handles expose typed snapshots and reset watches", const catalog = CultMesh.collections(collection); assert.deepEqual( - (await catalog.latest(noteDocument, "local")).map(note => note.body).sort(), + (await catalog.latest(noteDocument, "local")).map(note => note.body).sort(), ["alpha", "bravo"], ); // A typed lookup is answered by its own type's handle; a handle of another type for the same schema is not it.