test: fixing broken test

test didn't throw the error, it was just returning it. So I removed
the try/catch and assigned the error to a variable

PR-URL: https://github.com/nodejs/node/pull/28345
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
melinamejia95 2019-06-21 16:20:39 -05:00 committed by ZYSzys
parent 945134361f
commit fad3b64350

View File

@ -6,7 +6,7 @@ const { Readable } = require('stream');
const { strictEqual } = require('assert');
async function toReadableBasicSupport() {
async function * generate() {
async function* generate() {
yield 'a';
yield 'b';
yield 'c';
@ -22,7 +22,7 @@ async function toReadableBasicSupport() {
}
async function toReadableSyncIterator() {
function * generate() {
function* generate() {
yield 'a';
yield 'b';
yield 'c';
@ -64,7 +64,7 @@ async function toReadableString() {
}
async function toReadableOnData() {
async function * generate() {
async function* generate() {
yield 'a';
yield 'b';
yield 'c';
@ -86,7 +86,7 @@ async function toReadableOnData() {
}
async function toReadableOnDataNonObject() {
async function * generate() {
async function* generate() {
yield 'a';
yield 'b';
yield 'c';
@ -109,7 +109,7 @@ async function toReadableOnDataNonObject() {
}
async function destroysTheStreamWhenThrowing() {
async function * generate() {
async function* generate() {
throw new Error('kaboom');
}
@ -117,16 +117,14 @@ async function destroysTheStreamWhenThrowing() {
stream.read();
try {
await once(stream, 'error');
} catch (err) {
strictEqual(err.message, 'kaboom');
strictEqual(stream.destroyed, true);
}
const [err] = await once(stream, 'error');
strictEqual(err.message, 'kaboom');
strictEqual(stream.destroyed, true);
}
async function asTransformStream() {
async function * generate(stream) {
async function* generate(stream) {
for await (const chunk of stream) {
yield chunk.toUpperCase();
}