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

Function testPushWithTransforms

test/parallel/test-stream-iter-push-basic.js:136–152  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

134}
135
136async function testPushWithTransforms() {
137 const upper = (chunks) => {
138 if (chunks === null) return null;
139 return chunks.map((c) => {
140 const str = new TextDecoder().decode(c);
141 return new TextEncoder().encode(str.toUpperCase());
142 });
143 };
144
145 const { writer, readable } = push(upper);
146
147 writer.write('hello');
148 writer.end();
149
150 const data = await text(readable);
151 assert.strictEqual(data, 'HELLO');
152}
153
154async function testInvalidBackpressure() {
155 assert.throws(() => push({ backpressure: 'banana' }), {

Callers 1

Calls 4

pushFunction · 0.70
textFunction · 0.50
writeMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…