MCPcopy Create free account
hub / github.com/Faleij/json-stream-stringify / createTest

Function createTest

test-src/JsonStreamStringify.spec.ts:17–37  ·  view source on GitHub ↗
(input, expected, ...args)

Source from the content-addressed store, hash-verified

15}
16
17function createTest(input, expected, ...args) {
18 return () => new Promise<{ jsonStream: InstanceType<typeof JsonStreamStringify> }>((resolve, reject) => {
19 let str = '';
20 const jsonStream = new JsonStreamStringify(input, ...args)
21 .once('end', () => {
22 try {
23 expect(str).to.equal(expected);
24 } catch (err) {
25 reject(err);
26 return;
27 }
28 resolve({ jsonStream });
29 })
30 .once('error', err => {
31 reject(Object.assign(err, { jsonStream }))
32 })
33 .on('data', (data) => {
34 str += data.toString();
35 });
36 });
37}
38
39function readableStream(...args) {
40 const stream = new Readable({

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…