From 9e4ce6fc8ee511a8e885ee5c530f8ae12c0322e2 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 17 Nov 2016 10:25:57 -0800 Subject: [PATCH] test: refactor test-async-wrap-* * `assert.equal()` -> `assert.strictEqual()` * add duration to `setTimeout()` PR-URL: https://github.com/nodejs/node/pull/9663 Reviewed-By: Ben Noordhuis Reviewed-By: Colin Ihrig Reviewed-By: Santiago Gimeno Reviewed-By: James M Snell Reviewed-By: Luigi Pinca Reviewed-By: Prince John Wesley --- test/parallel/test-async-wrap-check-providers.js | 2 +- .../test-async-wrap-disabled-propagate-parent.js | 14 +++++++------- test/parallel/test-async-wrap-propagate-parent.js | 14 +++++++------- .../test-async-wrap-throw-from-callback.js | 6 +++--- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/test/parallel/test-async-wrap-check-providers.js b/test/parallel/test-async-wrap-check-providers.js index 28544538f1124a..a130e130e98a8e 100644 --- a/test/parallel/test-async-wrap-check-providers.js +++ b/test/parallel/test-async-wrap-check-providers.js @@ -41,7 +41,7 @@ async_wrap.setupHooks({ init }); async_wrap.enable(); -setTimeout(function() { }); +setTimeout(function() { }, 1); fs.stat(__filename, noop); diff --git a/test/parallel/test-async-wrap-disabled-propagate-parent.js b/test/parallel/test-async-wrap-disabled-propagate-parent.js index 5b6dd837de2774..4a6df7500956bf 100644 --- a/test/parallel/test-async-wrap-disabled-propagate-parent.js +++ b/test/parallel/test-async-wrap-disabled-propagate-parent.js @@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) { cntr++; // Cannot assert in init callback or will abort. process.nextTick(() => { - assert.equal(providers[type], 'TCPWRAP'); - assert.equal(parentUid, server._handle[uidSymbol], - 'server uid doesn\'t match parent uid'); - assert.equal(parentHandle, server._handle, - 'server handle doesn\'t match parent handle'); - assert.equal(this, client._handle, 'client doesn\'t match context'); + assert.strictEqual(providers[type], 'TCPWRAP'); + assert.strictEqual(parentUid, server._handle[uidSymbol], + 'server uid doesn\'t match parent uid'); + assert.strictEqual(parentHandle, server._handle, + 'server handle doesn\'t match parent handle'); + assert.strictEqual(this, client._handle, 'client doesn\'t match context'); }); } } @@ -48,5 +48,5 @@ async_wrap.disable(); process.on('exit', function() { // init should have only been called once with a parent. - assert.equal(cntr, 1); + assert.strictEqual(cntr, 1); }); diff --git a/test/parallel/test-async-wrap-propagate-parent.js b/test/parallel/test-async-wrap-propagate-parent.js index a3902081ea7708..0968490f5975cc 100644 --- a/test/parallel/test-async-wrap-propagate-parent.js +++ b/test/parallel/test-async-wrap-propagate-parent.js @@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) { cntr++; // Cannot assert in init callback or will abort. process.nextTick(() => { - assert.equal(providers[type], 'TCPWRAP'); - assert.equal(parentUid, server._handle[uidSymbol], - 'server uid doesn\'t match parent uid'); - assert.equal(parentHandle, server._handle, - 'server handle doesn\'t match parent handle'); - assert.equal(this, client._handle, 'client doesn\'t match context'); + assert.strictEqual(providers[type], 'TCPWRAP'); + assert.strictEqual(parentUid, server._handle[uidSymbol], + 'server uid doesn\'t match parent uid'); + assert.strictEqual(parentHandle, server._handle, + 'server handle doesn\'t match parent handle'); + assert.strictEqual(this, client._handle, 'client doesn\'t match context'); }); } } @@ -47,5 +47,5 @@ const server = net.createServer(function(c) { process.on('exit', function() { // init should have only been called once with a parent. - assert.equal(cntr, 1); + assert.strictEqual(cntr, 1); }); diff --git a/test/parallel/test-async-wrap-throw-from-callback.js b/test/parallel/test-async-wrap-throw-from-callback.js index e2e01e97ad6db9..93b5bee470ce3f 100644 --- a/test/parallel/test-async-wrap-throw-from-callback.js +++ b/test/parallel/test-async-wrap-throw-from-callback.js @@ -40,8 +40,8 @@ if (typeof process.argv[2] === 'string') { } else { process.on('exit', (code) => { - assert.equal(msgCalled, callbacks.length); - assert.equal(msgCalled, msgReceived); + assert.strictEqual(msgCalled, callbacks.length); + assert.strictEqual(msgCalled, msgReceived); }); callbacks.forEach((item) => { @@ -58,7 +58,7 @@ if (typeof process.argv[2] === 'string') { if (errstring.includes('Error: ' + item)) msgReceived++; - assert.equal(code, 1, `${item} closed with code ${code}`); + assert.strictEqual(code, 1, `${item} closed with code ${code}`); }); }); }