summaryrefslogtreecommitdiff
path: root/test/parallel/test-stream-map.js
diff options
context:
space:
mode:
authoriMoses <imoses.g@gmail.com>2022-01-27 18:53:00 +0200
committerGitHub <noreply@github.com>2022-01-27 16:53:00 +0000
commit5d9caa1c2f24e5e677348812f2a938847dc9690d (patch)
treebdde81130c38cd12817633929a30ce85559354f0 /test/parallel/test-stream-map.js
parent7752eedcc7db586fb0a7c586908d4405c6408325 (diff)
downloadnode-new-5d9caa1c2f24e5e677348812f2a938847dc9690d.tar.gz
stream: use synchronous error validation on iteration helpers
is no longer a generator function, instead it returns a called generator so that validation can be synchronous and not wait for the first iteration Fixes: https://github.com/nodejs/node/issues/41648 PR-URL: https://github.com/nodejs/node/pull/41652 Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com>
Diffstat (limited to 'test/parallel/test-stream-map.js')
-rw-r--r--test/parallel/test-stream-map.js19
1 files changed, 5 insertions, 14 deletions
diff --git a/test/parallel/test-stream-map.js b/test/parallel/test-stream-map.js
index c3a994ae39..24da9419f3 100644
--- a/test/parallel/test-stream-map.js
+++ b/test/parallel/test-stream-map.js
@@ -175,20 +175,11 @@ const { setTimeout } = require('timers/promises');
{
// Error cases
- assert.rejects(async () => {
- // eslint-disable-next-line no-unused-vars
- for await (const unused of Readable.from([1]).map(1));
- }, /ERR_INVALID_ARG_TYPE/).then(common.mustCall());
- assert.rejects(async () => {
- // eslint-disable-next-line no-unused-vars
- for await (const _ of Readable.from([1]).map((x) => x, {
- concurrency: 'Foo'
- }));
- }, /ERR_OUT_OF_RANGE/).then(common.mustCall());
- assert.rejects(async () => {
- // eslint-disable-next-line no-unused-vars
- for await (const _ of Readable.from([1]).map((x) => x, 1));
- }, /ERR_INVALID_ARG_TYPE/).then(common.mustCall());
+ assert.throws(() => Readable.from([1]).map(1), /ERR_INVALID_ARG_TYPE/);
+ assert.throws(() => Readable.from([1]).map((x) => x, {
+ concurrency: 'Foo'
+ }), /ERR_OUT_OF_RANGE/);
+ assert.throws(() => Readable.from([1]).map((x) => x, 1), /ERR_INVALID_ARG_TYPE/);
}
{
// Test result is a Readable