test: use strict equality for schema snapshot comparisons

A test whose job is catching subtle JSON-serializer drift should not use
loose comparison - deepEqual would pass a string 1 against a numeric 1.
Also documents the zod/v4 isSchemaOptional() quirk on bare .default()
at the call site rather than only in a planning doc.
This commit is contained in:
FilipBl4gojevic
2026-07-27 17:08:11 +02:00
parent c607c50911
commit b3971aefa5
2 changed files with 8 additions and 4 deletions

View File

@@ -713,6 +713,10 @@ activity tracking token (\`pact_\`) minted. Visible on the Foundation dashboard.
mnemonic: z.string().describe("15 or 24-word BIP39 mnemonic for the wallet"),
agentDid: z.string().describe("Agent DID (hex)"),
proposalTxHash: z.string().describe("TX hash of the proposal UTxO to critique"),
// Note: a bare .default() without .optional() is reported as *required* by the
// SDK's isSchemaOptional() under zod/v4 (it returned optional under v3). That
// helper is only used for server.prompt() argument listing, which this codebase
// does not use — harmless for server.tool(), but relevant if prompts are added.
proposalOutputIndex: z.number().default(0).describe("Output index of the proposal UTxO"),
critiqueDocument: z.string().optional().describe("Full critique document as JSON string. Uploaded to IPFS via Filebase; hash and CID computed automatically."),
critiqueHash: z.string().optional().describe("blake2b_256 hash of critique document (64 hex chars). Required if critiqueDocument is not provided."),

View File

@@ -92,7 +92,7 @@ describe('tool inventory smoke test', () => {
const added = actualNames.filter((name) => !EXPECTED_TOOLS.includes(name));
const removed = EXPECTED_TOOLS.filter((name) => !actualNames.includes(name));
assert.deepEqual(
assert.deepStrictEqual(
actualNames,
EXPECTED_TOOLS,
'Tool inventory drifted from the checked-in snapshot in test/smoke/tool-inventory.test.ts.\n' +
@@ -109,7 +109,7 @@ describe('tool schema snapshot', () => {
const missingFromSnapshot = actualNames.filter((name) => !snapshotNames.includes(name));
const staleInSnapshot = snapshotNames.filter((name) => !actualNames.includes(name));
assert.deepEqual(
assert.deepStrictEqual(
snapshotNames,
actualNames,
'test/smoke/tool-schemas.snapshot.json keys do not match the live tool set.\n' +
@@ -119,7 +119,7 @@ describe('tool schema snapshot', () => {
);
});
// One assertion per tool (rather than a single deepEqual over the whole
// One assertion per tool (rather than a single deepStrictEqual over the whole
// 23-tool map) so a failure names the specific tool and shows a readable
// diff of just that tool's schema, instead of "objects differ" over an
// unreadable combined structure.
@@ -130,7 +130,7 @@ describe('tool schema snapshot', () => {
live,
`Tool "${toolName}" is in the snapshot but was not returned by the live server's listTools().`
);
assert.deepEqual(
assert.deepStrictEqual(
live.inputSchema,
schemaSnapshot[toolName],
`inputSchema for "${toolName}" differs from the checked-in snapshot in test/smoke/tool-schemas.snapshot.json.\n` +