mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 21:19:50 +01:00
71d7707792
Co-authored-by: Benjamin Gruenbaum <benjamingr@gmail.com> PR-URL: https://github.com/nodejs/node/pull/48518 Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: Erick Wendel <erick.workspace@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
24 lines
563 B
JavaScript
24 lines
563 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
const { Readable } = require('stream');
|
|
const assert = require('assert');
|
|
|
|
{
|
|
const read = new Readable({
|
|
read() {}
|
|
});
|
|
read.resume();
|
|
|
|
read.on('end', common.mustNotCall('no end event'));
|
|
read.on('close', common.mustCall());
|
|
read.on('error', common.mustCall((err) => {
|
|
assert.strictEqual(err.name, 'AbortError');
|
|
}));
|
|
|
|
read[Symbol.asyncDispose]().then(common.mustCall(() => {
|
|
assert.strictEqual(read.errored.name, 'AbortError');
|
|
assert.strictEqual(read.destroyed, true);
|
|
}));
|
|
}
|