MCPcopy Create free account
hub / github.com/denoland/std / assertInvalidStringify

Function assertInvalidStringify

json/stringify_stream_test.ts:21–36  ·  view source on GitHub ↗
(
  transformer: typeof JsonStringifyStream,
  chunks: unknown[],
  options: StringifyStreamOptions,
  // deno-lint-ignore no-explicit-any
  ErrorClass: new (...args: any[]) => Error,
  msgIncludes: string | undefined,
)

Source from the content-addressed store, hash-verified

19}
20
21async function assertInvalidStringify(
22 transformer: typeof JsonStringifyStream,
23 chunks: unknown[],
24 options: StringifyStreamOptions,
25 // deno-lint-ignore no-explicit-any
26 ErrorClass: new (...args: any[]) => Error,
27 msgIncludes: string | undefined,
28) {
29 const r = ReadableStream.from(chunks)
30 .pipeThrough(new transformer(options));
31 await assertRejects(
32 async () => await Array.fromAsync(r),
33 ErrorClass,
34 msgIncludes,
35 );
36}
37
38Deno.test({
39 name: "JsonStringifyStream",

Callers 1

fnFunction · 0.85

Calls 2

assertRejectsFunction · 0.90
fromMethod · 0.45

Tested by

no test coverage detected