Skip to content

Commit 5111e92

Browse files
committed
test(mcp): cover the payload path JSON.stringify declines to represent
The last two partial branches on the contract's telemetry module: stringify answers undefined for a bare function or symbol rather than throwing, so the nullish arm and the empty-string check are a separate path from the catch that handles a BigInt. 100% branches on the module now.
1 parent 431b7ac commit 5111e92

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/unit/mcp-dispatch-telemetry.test.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,14 @@ describe("MCP telemetry redaction (#9525)", () => {
116116
it("returns undefined rather than throwing on a genuinely unserializable payload", () => {
117117
expect(capturePayload({ big: BigInt(1) })).toBeUndefined();
118118
});
119+
120+
it("returns undefined for a value JSON.stringify simply declines to represent", () => {
121+
// Not an error, just nothing: stringify answers `undefined` for a bare function or symbol
122+
// rather than throwing, so the nullish arm and the empty-string check are a separate path from
123+
// the catch above.
124+
expect(capturePayload(() => undefined)).toBeUndefined();
125+
expect(capturePayload(Symbol("s"))).toBeUndefined();
126+
});
119127
});
120128

121129
describe("MCP telemetry error codes (#9525)", () => {

0 commit comments

Comments
 (0)