From 9d12ec392bce77f8951fdcc74af06c0ac95a9828 Mon Sep 17 00:00:00 2001 From: Meta Vens Date: Mon, 19 Oct 2026 15:44:12 +0200 Subject: [PATCH] cultnet-ts content test: encode 64-bit boundary values as bigints The encoder writes a number past uint32 as float64 under useBigInt64; the old tests leaned on the decoder accepting that float. The reference refuses a float, so the fixtures now use bigint (uint64/int64) encodings. Co-Authored-By: Claude Opus 5.5 --- packages/cultnet-ts/test/content.test.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/cultnet-ts/test/content.test.ts b/packages/cultnet-ts/test/content.test.ts index 31bcab9a..af18b16d 100644 --- a/packages/cultnet-ts/test/content.test.ts +++ b/packages/cultnet-ts/test/content.test.ts @@ -154,7 +154,6 @@ test("a metadata key that is not a string is refused", () => { test("an integer field accepts any width and refuses what a JS number cannot hold exactly", () => { const empty = { 4: 0, 7: [] as unknown[] }; // Past the integer rule, a size nothing sums to fails the sum check; a refused integer fails the type check first. - assert.throws(() => decodeManifest(wire({ ...empty, 4: 2 ** 53 - 1 })), /do not sum/); assert.throws(() => decodeManifest(wire({ ...empty, 4: 2n ** 53n - 1n })), /do not sum/); assert.throws(() => decodeManifest(wire({ ...empty, 4: 2n ** 53n })), /wrong type/); assert.throws(() => decodeManifest(wire({ ...empty, 4: 2n ** 53n + 1n })), /wrong type/); @@ -172,7 +171,7 @@ test("a chunk size outside int32 is refused as the reference's int cannot hold i const chunk = (size: number) => decodeManifest(wire({ 4: size, 7: [[HASH, 0, size, "k"]] })); assert.equal(chunk(2 ** 31 - 1).chunks[0]!.sizeBytes, 2 ** 31 - 1); assert.throws(() => chunk(2 ** 31), /chunks\.sizeBytes.*wrong type/); - assert.throws(() => decodeManifest(wire({ 4: -(2 ** 31) - 1, 7: [[HASH, 0, -(2 ** 31) - 1, "k"]] })), /chunks\.sizeBytes.*wrong type/); + assert.throws(() => decodeManifest(wire({ 4: -(2n ** 31n) - 1n, 7: [[HASH, 0, -(2n ** 31n) - 1n, "k"]] })), /chunks\.sizeBytes.*wrong type/); assert.throws(() => decodeManifest(wire({ 4: 0, 7: [[HASH, 0, -(2 ** 31), "k"]] })), /chunk has a negative size/); });