Skip to content

Commit ea6941f

Browse files
Trottjasnell
authored andcommitted
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 <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
1 parent 686dd36 commit ea6941f

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

test/parallel/test-fs-assert-encoding-error.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -7,59 +7,59 @@ const options = 'test';
77
const unknownEncodingMessage = /^Error: Unknown encoding: test$/;
88

99
assert.throws(() => {
10-
fs.readFile('path', options, common.noop);
10+
fs.readFile('path', options, common.mustNotCall());
1111
}, unknownEncodingMessage);
1212

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

1717
assert.throws(() => {
18-
fs.readdir('path', options, common.noop);
18+
fs.readdir('path', options, common.mustNotCall());
1919
}, unknownEncodingMessage);
2020

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

2525
assert.throws(() => {
26-
fs.readlink('path', options, common.noop);
26+
fs.readlink('path', options, common.mustNotCall());
2727
}, unknownEncodingMessage);
2828

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

3333
assert.throws(() => {
34-
fs.writeFile('path', 'data', options, common.noop);
34+
fs.writeFile('path', 'data', options, common.mustNotCall());
3535
}, unknownEncodingMessage);
3636

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

4141
assert.throws(() => {
42-
fs.appendFile('path', 'data', options, common.noop);
42+
fs.appendFile('path', 'data', options, common.mustNotCall());
4343
}, unknownEncodingMessage);
4444

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

4949
assert.throws(() => {
50-
fs.watch('path', options, common.noop);
50+
fs.watch('path', options, common.mustNotCall());
5151
}, unknownEncodingMessage);
5252

5353
assert.throws(() => {
54-
fs.realpath('path', options, common.noop);
54+
fs.realpath('path', options, common.mustNotCall());
5555
}, unknownEncodingMessage);
5656

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

6161
assert.throws(() => {
62-
fs.mkdtemp('path', options, common.noop);
62+
fs.mkdtemp('path', options, common.mustNotCall());
6363
}, unknownEncodingMessage);
6464

6565
assert.throws(() => {

0 commit comments

Comments
 (0)