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

Function testPullSyncStatefulTransform

test/parallel/test-stream-iter-pull-sync.js:26–45  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

24}
25
26function testPullSyncStatefulTransform() {
27 const source = fromSync('data');
28 const stateful = {
29 transform: function*(source) {
30 for (const chunks of source) {
31 if (chunks === null) {
32 // Flush: emit trailer
33 yield new TextEncoder().encode('-END');
34 continue;
35 }
36 for (const chunk of chunks) {
37 yield chunk;
38 }
39 }
40 },
41 };
42 const result = pullSync(source, stateful);
43 const data = new TextDecoder().decode(bytesSync(result));
44 assert.strictEqual(data, 'data-END');
45}
46
47function testPullSyncChainedTransforms() {
48 const addExcl = (chunks) => {

Callers 1

Calls 5

pullSyncFunction · 0.85
bytesSyncFunction · 0.85
encodeMethod · 0.80
decodeMethod · 0.65
fromSyncFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…