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>
This commit is contained in:
parent
c1dee6ac97
commit
d13bd4acc0
@ -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(() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user