mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 15:04:11 -05:00
test(node_compat): enable more stream-writable tests (#24328)
This commit is contained in:
parent
1e8a6b94b1
commit
b71a859188
6 changed files with 127 additions and 4 deletions
|
@ -575,6 +575,7 @@
|
|||
"test-stream-unpipe-event.js",
|
||||
"test-stream-unshift-empty-chunk.js",
|
||||
"test-stream-unshift-read-race.js",
|
||||
"test-stream-writable-aborted.js",
|
||||
"test-stream-writable-change-default-encoding.js",
|
||||
"test-stream-writable-clear-buffer.js",
|
||||
"test-stream-writable-constructor-set-methods.js",
|
||||
|
@ -583,6 +584,9 @@
|
|||
"test-stream-writable-end-cb-error.js",
|
||||
"test-stream-writable-end-multiple.js",
|
||||
"test-stream-writable-ended-state.js",
|
||||
"test-stream-writable-final-async.js",
|
||||
"test-stream-writable-final-destroy.js",
|
||||
"test-stream-writable-final-throw.js",
|
||||
"test-stream-writable-finish-destroyed.js",
|
||||
"test-stream-writable-finished-state.js",
|
||||
"test-stream-writable-finished.js",
|
||||
|
|
|
@ -2298,11 +2298,7 @@ NOTE: This file should not be manually edited. Please edit `tests/node_compat/co
|
|||
- [parallel/test-stream-wrap-drain.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-wrap-drain.js)
|
||||
- [parallel/test-stream-wrap-encoding.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-wrap-encoding.js)
|
||||
- [parallel/test-stream-wrap.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-wrap.js)
|
||||
- [parallel/test-stream-writable-aborted.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-aborted.js)
|
||||
- [parallel/test-stream-writable-end-cb-uncaught.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-end-cb-uncaught.js)
|
||||
- [parallel/test-stream-writable-final-async.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-final-async.js)
|
||||
- [parallel/test-stream-writable-final-destroy.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-final-destroy.js)
|
||||
- [parallel/test-stream-writable-final-throw.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-final-throw.js)
|
||||
- [parallel/test-stream-writable-samecb-singletick.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream-writable-samecb-singletick.js)
|
||||
- [parallel/test-stream2-finish-pipe-error.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream2-finish-pipe-error.js)
|
||||
- [parallel/test-stream2-httpclient-response-end.js](https://github.com/nodejs/node/tree/v18.12.1/test/parallel/test-stream2-httpclient-response-end.js)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
require('../common');
|
||||
const assert = require('assert');
|
||||
const { Writable } = require('stream');
|
||||
|
||||
{
|
||||
const writable = new Writable({
|
||||
write() {
|
||||
}
|
||||
});
|
||||
assert.strictEqual(writable.writableAborted, false);
|
||||
writable.destroy();
|
||||
assert.strictEqual(writable.writableAborted, true);
|
||||
}
|
||||
|
||||
{
|
||||
const writable = new Writable({
|
||||
write() {
|
||||
}
|
||||
});
|
||||
assert.strictEqual(writable.writableAborted, false);
|
||||
writable.end();
|
||||
writable.destroy();
|
||||
assert.strictEqual(writable.writableAborted, true);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const {
|
||||
Duplex,
|
||||
} = require('stream');
|
||||
const { setTimeout } = require('timers/promises');
|
||||
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
async _final(callback) {
|
||||
await setTimeout(common.platformTimeout(1));
|
||||
callback();
|
||||
}
|
||||
|
||||
_read() {}
|
||||
}
|
||||
|
||||
const foo = new Foo();
|
||||
foo._write = common.mustCall((chunk, encoding, cb) => {
|
||||
cb();
|
||||
});
|
||||
foo.end('test', common.mustCall());
|
||||
foo.on('error', common.mustNotCall());
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
const common = require('../common');
|
||||
|
||||
const { Writable } = require('stream');
|
||||
|
||||
{
|
||||
const w = new Writable({
|
||||
write(chunk, encoding, callback) {
|
||||
callback(null);
|
||||
},
|
||||
final(callback) {
|
||||
queueMicrotask(callback);
|
||||
}
|
||||
});
|
||||
w.end();
|
||||
w.destroy();
|
||||
|
||||
w.on('prefinish', common.mustNotCall());
|
||||
w.on('finish', common.mustNotCall());
|
||||
w.on('close', common.mustCall());
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// deno-fmt-ignore-file
|
||||
// deno-lint-ignore-file
|
||||
|
||||
// Copyright Joyent and Node contributors. All rights reserved. MIT license.
|
||||
// Taken from Node 18.12.1
|
||||
// This file is automatically generated by `tests/node_compat/runner/setup.ts`. Do not modify this file manually.
|
||||
|
||||
'use strict';
|
||||
|
||||
const common = require('../common');
|
||||
const {
|
||||
Duplex,
|
||||
} = require('stream');
|
||||
|
||||
{
|
||||
class Foo extends Duplex {
|
||||
_final(callback) {
|
||||
throw new Error('fhqwhgads');
|
||||
}
|
||||
|
||||
_read() {}
|
||||
}
|
||||
|
||||
const foo = new Foo();
|
||||
foo._write = common.mustCall((chunk, encoding, cb) => {
|
||||
cb();
|
||||
});
|
||||
foo.end('test', common.expectsError({ message: 'fhqwhgads' }));
|
||||
foo.on('error', common.mustCall());
|
||||
}
|
Loading…
Reference in a new issue