diff --git a/packages/thing-contract/src/domain.ts b/packages/thing-contract/src/domain.ts index f528746..7bbaea8 100644 --- a/packages/thing-contract/src/domain.ts +++ b/packages/thing-contract/src/domain.ts @@ -73,8 +73,8 @@ export function present(codec: Codec): Codec { if (!("names" in codec)) return held; const record = codec as SlotsCodec; return Object.defineProperties(held, { - names: { get: () => record.names, enumerable: true }, - members: { get: () => record.members, enumerable: true }, + names: { get: () => record.names }, + members: { get: () => record.members }, }); } diff --git a/packages/thing-contract/test/names.test.ts b/packages/thing-contract/test/names.test.ts index 7f89226..51bdcf1 100644 --- a/packages/thing-contract/test/names.test.ts +++ b/packages/thing-contract/test/names.test.ts @@ -53,3 +53,13 @@ test("TextInputNode's slot 2 is inputKind, and the name set holds no Kind-only s assert.ok(names.has(`${NS}InputKind`)); assert.equal([...names].filter((name) => name.endsWith(".Kind")).length, 0); }); + +test("a record keeps its slot names and members through presence, and a union, a list and a leaf carry none", () => { + const shapes = codecs as unknown as Record; + for (const record of ["boxNode", "bind", "nodeCommon", "rgba", "dimensionPx"]) { + assert.ok("names" in shapes[record] && "members" in shapes[record], record); + } + for (const other of ["node", "memberStep", "dimension", "colorRef"]) { + assert.ok(!("names" in shapes[other]) && !("members" in shapes[other]), other); + } +});