Skip to content

Commit 388099e

Browse files
committed
fixup! fixup! fixup! stream: add iterator helper find
1 parent 0562664 commit 388099e

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

test/parallel/test-stream-filter.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,3 +98,9 @@ const { setTimeout } = require('timers/promises');
9898
const stream = Readable.from([1, 2, 3, 4, 5]).filter((x) => true);
9999
assert.strictEqual(stream.readable, true);
100100
}
101+
{
102+
const stream = Readable.from([1, 2, 3, 4, 5]);
103+
stream.map = common.mustNotCall(() => {});
104+
// Check that map isn't getting called.
105+
stream.filter(() => true);
106+
}

test/parallel/test-stream-flatMap.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,9 @@ function oneTo5() {
121121
const stream = oneTo5().flatMap((x) => x);
122122
assert.strictEqual(stream.readable, true);
123123
}
124+
{
125+
const stream = oneTo5();
126+
stream.map = common.mustNotCall(() => {});
127+
// Check that map isn't getting called.
128+
stream.flatMap(() => true);
129+
}

test/parallel/test-stream-forEach.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,9 @@ const { setTimeout } = require('timers/promises');
8484
const stream = Readable.from([1, 2, 3, 4, 5]).forEach((_) => true);
8585
assert.strictEqual(typeof stream.then, 'function');
8686
}
87+
{
88+
const stream = Readable.from([1, 2, 3, 4, 5]);
89+
stream.map = common.mustNotCall(() => {});
90+
// Check that map isn't getting called.
91+
stream.forEach(() => true);
92+
}

test/parallel/test-stream-some-find-every.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,11 @@ function oneTo5Async() {
162162
}, /ERR_INVALID_ARG_TYPE/, `${op} should throw for invalid signal`).then(common.mustCall());
163163
}
164164
}
165+
{
166+
for (const op of ['some', 'every', 'find']) {
167+
const stream = oneTo5();
168+
stream.map = common.mustNotCall(() => {});
169+
// Check that map isn't getting called.
170+
stream[op](() => {});
171+
}
172+
}

0 commit comments

Comments
 (0)