diff options
author | Vse Mozhet Byt <vsemozhetbyt@gmail.com> | 2017-06-14 17:42:39 +0300 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-21 22:43:08 +0200 |
commit | 80e6524ff093878466a65550fccf3b42e5ce5ad9 (patch) | |
tree | 1136b7307aaae80660b787d3b073ee3aed7109e3 | |
parent | 406c09aacbcb82254f721a6749edb39a2539e383 (diff) | |
download | node-new-80e6524ff093878466a65550fccf3b42e5ce5ad9.tar.gz |
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: https://github.com/nodejs/node/pull/13680
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
-rw-r--r-- | test/parallel/test-fs-mkdir-rmdir.js | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/test/parallel/test-fs-mkdir-rmdir.js b/test/parallel/test-fs-mkdir-rmdir.js index bac18fc027..8c22331e85 100644 --- a/test/parallel/test-fs-mkdir-rmdir.js +++ b/test/parallel/test-fs-mkdir-rmdir.js @@ -24,14 +24,15 @@ fs.rmdirSync(d); assert(!common.fileExists(d)); // Similarly test the Async version -fs.mkdir(d, 0o666, function(err) { +fs.mkdir(d, 0o666, common.mustCall(function(err) { assert.ifError(err); - fs.mkdir(d, 0o666, function(err) { - assert.ok(err.message.match(/^EEXIST/), 'got EEXIST message'); - assert.strictEqual(err.code, 'EEXIST', 'got EEXIST code'); - assert.strictEqual(err.path, d, 'got proper path for EEXIST'); + fs.mkdir(d, 0o666, common.mustCall(function(err) { + assert.ok(err, 'got no error'); + assert.ok(/^EEXIST/.test(err.message), 'got no EEXIST message'); + assert.strictEqual(err.code, 'EEXIST', 'got no EEXIST code'); + assert.strictEqual(err.path, d, 'got no proper path for EEXIST'); fs.rmdir(d, assert.ifError); - }); -}); + })); +})); |