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

Function testBasicDuplex

test/parallel/test-stream-iter-duplex.js:12–21  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

10// =============================================================================
11
12async function testBasicDuplex() {
13 const [channelA, channelB] = duplex();
14
15 // A writes, B reads
16 await channelA.writer.write('hello from A');
17 await channelA.close();
18
19 const dataAtB = await text(channelB.readable);
20 assert.strictEqual(dataAtB, 'hello from A');
21}
22
23async function testBidirectional() {
24 const [channelA, channelB] = duplex();

Callers 1

Calls 4

duplexFunction · 0.85
closeMethod · 0.65
textFunction · 0.50
writeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…