Skip to content
Permalink
Browse files

test: refactor test-fs-assert-encoding-error

Check that callbacks are not executed when errors are expected to be
thrown.

PR-URL: #13226
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
  • Loading branch information...
Trott authored and jasnell committed May 25, 2017
1 parent 686dd36 commit ea6941f703a63c51beb7b59f1f5d803355188ffa
Showing with 8 additions and 8 deletions.
  1. +8 −8 test/parallel/test-fs-assert-encoding-error.js
@@ -7,59 +7,59 @@ const options = 'test';
const unknownEncodingMessage = /^Error: Unknown encoding: test$/;

assert.throws(() => {
fs.readFile('path', options, common.noop);
fs.readFile('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.readFileSync('path', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.readdir('path', options, common.noop);
fs.readdir('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.readdirSync('path', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.readlink('path', options, common.noop);
fs.readlink('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.readlinkSync('path', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.writeFile('path', 'data', options, common.noop);
fs.writeFile('path', 'data', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.writeFileSync('path', 'data', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.appendFile('path', 'data', options, common.noop);
fs.appendFile('path', 'data', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.appendFileSync('path', 'data', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.watch('path', options, common.noop);
fs.watch('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.realpath('path', options, common.noop);
fs.realpath('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {
fs.realpathSync('path', options);
}, unknownEncodingMessage);

assert.throws(() => {
fs.mkdtemp('path', options, common.noop);
fs.mkdtemp('path', options, common.mustNotCall());
}, unknownEncodingMessage);

assert.throws(() => {

0 comments on commit ea6941f

Please sign in to comment.
You can’t perform that action at this time.