diff options
author | Anna Henningsen <anna@addaleax.net> | 2018-02-07 01:36:20 +0100 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-02-21 20:42:18 +0100 |
commit | 03ddd13d8a72190aa22194eb535e9cb683f4f815 (patch) | |
tree | a69fd4503770103c027fc4662752eb5964c98ee2 /test/parallel/test-stream-writable-destroy.js | |
parent | 6bdc18c592b9d66fd652a9bdaa53f87486d0a634 (diff) | |
download | android-node-v8-03ddd13d8a72190aa22194eb535e9cb683f4f815.tar.gz android-node-v8-03ddd13d8a72190aa22194eb535e9cb683f4f815.tar.bz2 android-node-v8-03ddd13d8a72190aa22194eb535e9cb683f4f815.zip |
net: use `_final` instead of `on('finish')`
Shutting down the connection is what `_final` is there for.
PR-URL: https://github.com/nodejs/node/pull/18608
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'test/parallel/test-stream-writable-destroy.js')
-rw-r--r-- | test/parallel/test-stream-writable-destroy.js | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/test/parallel/test-stream-writable-destroy.js b/test/parallel/test-stream-writable-destroy.js index 87e55eccc3..46c4851117 100644 --- a/test/parallel/test-stream-writable-destroy.js +++ b/test/parallel/test-stream-writable-destroy.js @@ -185,3 +185,17 @@ const { inherits } = require('util'); assert.strictEqual(expected, err); })); } + +{ + // Checks that `._undestroy()` restores the state so that `final` will be + // called again. + const write = new Writable({ + write: common.mustNotCall(), + final: common.mustCall((cb) => cb(), 2) + }); + + write.end(); + write.destroy(); + write._undestroy(); + write.end(); +} |