Skip to content

Commit

Permalink
test: refactor test-fs-assert-encoding-error
Browse files Browse the repository at this point in the history
Check that callbacks are not executed when errors are expected to be
thrown.

PR-URL: #13226
Reviewed-By: Gibson Fahnestock <[email protected]>
Reviewed-By: Refael Ackermann <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
Trott authored and jasnell committed May 29, 2017
1 parent 686dd36 commit ea6941f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/parallel/test-fs-assert-encoding-error.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(() => {
Expand Down

0 comments on commit ea6941f

Please sign in to comment.