Skip to content

Commit

Permalink
fix: avoid generating invalid json objects using fastcheck
Browse files Browse the repository at this point in the history
  • Loading branch information
aryanjassal committed Nov 29, 2024
1 parent acaf8ac commit 55b4cba
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions tests/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ const messagesToReadableStream = (messages: Array<JSONRPCMessage>) => {
*/
const safeJsonValueArb = fc
.json()
.map((value) => JSON.parse(value.replace('__proto__', 'proto')) as JSONValue)
.map((value) => JSON.parse(value.replaceAll('__proto__', 'proto')) as JSONValue)
.noShrink();

const safeJsonObjectArb = fc.dictionary(
fc.string().map((s) => s.replace('__proto__', 'proto')),
fc.string().map((s) => s.replaceAll('__proto__', 'proto')),
safeJsonValueArb,
) as fc.Arbitrary<JSONObject>;

Expand Down

0 comments on commit 55b4cba

Please sign in to comment.