Skip to content

Commit

Permalink
fixup! fixup! fixup! stream: add iterator helper find
Browse files Browse the repository at this point in the history
  • Loading branch information
Linkgoron committed Feb 5, 2022
1 parent 35fdf0e commit 543f5b3
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
6 changes: 6 additions & 0 deletions test/parallel/test-stream-filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,9 @@ const { setTimeout } = require('timers/promises');
const stream = Readable.from([1, 2, 3, 4, 5]).filter((x) => true);
assert.strictEqual(stream.readable, true);
}
{
const stream = Readable.from([1, 2, 3, 4, 5]);
stream.map = common.mustNotCall(() => {});
// Check that map isn't getting called.
stream.filter(() => true);
}
6 changes: 6 additions & 0 deletions test/parallel/test-stream-flatMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,9 @@ function oneTo5() {
const stream = oneTo5().flatMap((x) => x);
assert.strictEqual(stream.readable, true);
}
{
const stream = oneTo5();
stream.map = common.mustNotCall(() => {});
// Check that map isn't getting called.
stream.flatMap(() => true);
}
6 changes: 6 additions & 0 deletions test/parallel/test-stream-forEach.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,9 @@ const { setTimeout } = require('timers/promises');
const stream = Readable.from([1, 2, 3, 4, 5]).forEach((_) => true);
assert.strictEqual(typeof stream.then, 'function');
}
{
const stream = Readable.from([1, 2, 3, 4, 5]);
stream.map = common.mustNotCall(() => {});
// Check that map isn't getting called.
stream.forEach(() => true);
}
8 changes: 8 additions & 0 deletions test/parallel/test-stream-some-find-every.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,11 @@ function oneTo5Async() {
}, /ERR_INVALID_ARG_TYPE/, `${op} should throw for invalid signal`).then(common.mustCall());
}
}
{
for (const op of ['some', 'every', 'find']) {
const stream = oneTo5();
stream.map = common.mustNotCall(() => {});
// Check that map isn't getting called.
stream[op](() => {});
}
}

0 comments on commit 543f5b3

Please sign in to comment.