MCPcopy Index your code
hub / github.com/nodejs/node / testPullStatefulTransform

Function testPullStatefulTransform

test/parallel/test-stream-iter-pull-async.js:25–41  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23}
24
25async function testPullStatefulTransform() {
26 const stateful = {
27 transform: async function*(source) {
28 for await (const chunks of source) {
29 if (chunks === null) {
30 yield new TextEncoder().encode('-ASYNC-END');
31 continue;
32 }
33 for (const chunk of chunks) {
34 yield chunk;
35 }
36 }
37 },
38 };
39 const data = await text(pull(from('data'), stateful));
40 assert.strictEqual(data, 'data-ASYNC-END');
41}
42
43async function testPullWithAbortSignal() {
44 async function* gen() {

Callers 1

Calls 4

encodeMethod · 0.80
pullFunction · 0.70
textFunction · 0.50
fromFunction · 0.50

Tested by

no test coverage detected