From fa75be790102001b0ae403a57b979da36aad8783 Mon Sep 17 00:00:00 2001 From: Vse Mozhet Byt Date: Wed, 14 Jun 2017 17:42:39 +0300 Subject: [PATCH] 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 Reviewed-By: Luigi Pinca Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Michael Dawson --- test/parallel/test-fs-mkdir-rmdir.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-fs-mkdir-rmdir.js b/test/parallel/test-fs-mkdir-rmdir.js index bac18fc027931d..8c22331e85e3cd 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); - }); -}); + })); +}));