Skip to content

Commit 80e6524

Browse files
vsemozhetbytaddaleax
authored andcommitted
test: fix nits in test-fs-mkdir-rmdir.js
* Add common.mustCall(). * Add check for error existence, not only for error details. * Use test(), not match() in a boolean context. * Properly reverse meanings of assert messages. PR-URL: #13680 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent 406c09a commit 80e6524

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/parallel/test-fs-mkdir-rmdir.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,15 @@ fs.rmdirSync(d);
2424
assert(!common.fileExists(d));
2525

2626
// Similarly test the Async version
27-
fs.mkdir(d, 0o666, function(err) {
27+
fs.mkdir(d, 0o666, common.mustCall(function(err) {
2828
assert.ifError(err);
2929

30-
fs.mkdir(d, 0o666, function(err) {
31-
assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message');
32-
assert.strictEqual(err.code, 'EEXIST', 'got EEXIST code');
33-
assert.strictEqual(err.path, d, 'got proper path for EEXIST');
30+
fs.mkdir(d, 0o666, common.mustCall(function(err) {
31+
assert.ok(err, 'got no error');
32+
assert.ok(/^EEXIST/.test(err.message), 'got no EEXIST message');
33+
assert.strictEqual(err.code, 'EEXIST', 'got no EEXIST code');
34+
assert.strictEqual(err.path, d, 'got no proper path for EEXIST');
3435

3536
fs.rmdir(d, assert.ifError);
36-
});
37-
});
37+
}));
38+
}));

0 commit comments

Comments
 (0)