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

Function testTapAsync

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

Source from the content-addressed store, hash-verified

42}
43
44async function testTapAsync() {
45 const observed = [];
46 const observer = tap(async (chunks) => {
47 if (chunks !== null) {
48 observed.push(chunks.length);
49 }
50 });
51
52 assert.strictEqual(typeof observer, 'function');
53
54 const input = [new Uint8Array([1])];
55 const result = await observer(input);
56 assert.deepStrictEqual(result, input);
57 assert.deepStrictEqual(observed, [1]);
58}
59
60async function testTapInPipeline() {
61 const { writer, readable } = push();

Calls 3

tapFunction · 0.85
observerFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected