MCPcopy Create free account
hub / github.com/nodejs/node / testTapSyncInPipeline

Function testTapSyncInPipeline

test/parallel/test-stream-iter-consumers-tap.js:103–121  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

101
102// TapSync in a pullSync pipeline passes through data and flush
103function testTapSyncInPipeline() {
104 const seen = [];
105 let sawFlush = false;
106 const observer = tapSync((chunks) => {
107 if (chunks === null) {
108 sawFlush = true;
109 } else {
110 for (const chunk of chunks) {
111 seen.push(new TextDecoder().decode(chunk));
112 }
113 }
114 });
115
116 const data = textSync(pullSync(fromSync('hello'), observer));
117 assert.strictEqual(data, 'hello');
118 assert.strictEqual(seen.length, 1);
119 assert.strictEqual(seen[0], 'hello');
120 assert.strictEqual(sawFlush, true);
121}
122
123Promise.all([
124 testTapSync(),

Calls 6

tapSyncFunction · 0.85
textSyncFunction · 0.85
pullSyncFunction · 0.85
decodeMethod · 0.65
fromSyncFunction · 0.50
pushMethod · 0.45

Tested by

no test coverage detected