From 3114349c4c0a49553467d0456c1d71f185e9d987 Mon Sep 17 00:00:00 2001 From: RobotMermaid Date: Sat, 22 Apr 2017 11:58:11 -0700 Subject: [PATCH] test: cleanup test-fs-watch.js Reversed "actual" and "expected" arguments for assert.strictEqual(). Replaced constructor with regular expression for assert.throws(). PR-URL: https://github.com/nodejs/node/pull/12595 Reviewed-By: Colin Ihrig Reviewed-By: Bryan English Reviewed-By: Santiago Gimeno Reviewed-By: Gibson Fahnestock --- test/sequential/test-fs-watch.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/test/sequential/test-fs-watch.js b/test/sequential/test-fs-watch.js index b9798de9e165d7..1780099eba4f9b 100644 --- a/test/sequential/test-fs-watch.js +++ b/test/sequential/test-fs-watch.js @@ -36,10 +36,10 @@ assert.doesNotThrow( function() { const watcher = fs.watch(filepathOne); watcher.on('change', function(event, filename) { - assert.strictEqual('change', event); + assert.strictEqual(event, 'change'); if (expectFilePath) { - assert.strictEqual('watch.txt', filename); + assert.strictEqual(filename, 'watch.txt'); } watcher.close(); ++watchSeenOne; @@ -59,10 +59,10 @@ fs.writeFileSync(filepathTwoAbs, 'howdy'); assert.doesNotThrow( function() { const watcher = fs.watch(filepathTwo, function(event, filename) { - assert.strictEqual('change', event); + assert.strictEqual(event, 'change'); if (expectFilePath) { - assert.strictEqual('hasOwnProperty', filename); + assert.strictEqual(filename, 'hasOwnProperty'); } watcher.close(); ++watchSeenTwo; @@ -82,11 +82,11 @@ assert.doesNotThrow( function() { const watcher = fs.watch(testsubdir, function(event, filename) { const renameEv = common.isSunOS || common.isAix ? 'change' : 'rename'; - assert.strictEqual(renameEv, event); + assert.strictEqual(event, renameEv); if (expectFilePath) { - assert.strictEqual('newfile.txt', filename); + assert.strictEqual(filename, 'newfile.txt'); } else { - assert.strictEqual(null, filename); + assert.strictEqual(filename, null); } watcher.close(); ++watchSeenThree; @@ -113,7 +113,7 @@ assert.throws(function() { oldhandle = w._handle; w._handle = { close: w._handle.close }; w.close(); -}, TypeError); +}, /^TypeError: Illegal invocation$/); oldhandle.close(); // clean up assert.throws(function() { @@ -121,5 +121,5 @@ assert.throws(function() { oldhandle = w._handle; w._handle = { stop: w._handle.stop }; w.stop(); -}, TypeError); +}, /^TypeError: Illegal invocation$/); oldhandle.stop(); // clean up