diff options
author | Dejon "DJ" Gill <itsmed@users.noreply.github.com> | 2016-11-19 14:31:17 -0800 |
---|---|---|
committer | Franziska Hinkelmann <franzih@chromium.org> | 2017-03-26 14:14:34 +0200 |
commit | d13bd4acc0b60191f0d6e9fae92087242d04dfbd (patch) | |
tree | 97ddffe9a872517d5f61bce3ab6e770928849286 /test/parallel/test-fs-empty-readStream.js | |
parent | c1dee6ac9702877b9819058424823a3268d73e9d (diff) | |
download | node-new-d13bd4acc0b60191f0d6e9fae92087242d04dfbd.tar.gz |
test: replace throw with common.fail
Replace anonymous functions with arrow functions.
Replace throw new Error with common.fail.
PR-URL: https://github.com/nodejs/node/pull/9700
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
Diffstat (limited to 'test/parallel/test-fs-empty-readStream.js')
-rw-r--r-- | test/parallel/test-fs-empty-readStream.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/test/parallel/test-fs-empty-readStream.js b/test/parallel/test-fs-empty-readStream.js index 706a850b3c..85c38a61d0 100644 --- a/test/parallel/test-fs-empty-readStream.js +++ b/test/parallel/test-fs-empty-readStream.js @@ -28,29 +28,32 @@ const fs = require('fs'); const emptyFile = path.join(common.fixturesDir, 'empty.txt'); fs.open(emptyFile, 'r', common.mustCall((error, fd) => { + assert.ifError(error); - const read = fs.createReadStream(emptyFile, { 'fd': fd }); + const read = fs.createReadStream(emptyFile, { fd }); read.once('data', () => { - throw new Error('data event should not emit'); + common.fail('data event should not emit'); }); read.once('end', common.mustCall(function endEvent1() {})); })); fs.open(emptyFile, 'r', common.mustCall((error, fd) => { + assert.ifError(error); - const read = fs.createReadStream(emptyFile, { 'fd': fd }); + const read = fs.createReadStream(emptyFile, { fd }); + read.pause(); read.once('data', () => { - throw new Error('data event should not emit'); + common.fail('data event should not emit'); }); read.once('end', function endEvent2() { - throw new Error('end event should not emit'); + common.fail('end event should not emit'); }); setTimeout(common.mustCall(() => { |