Skip to content

Commit

Permalink
test: refactor test-async-wrap-*
Browse files Browse the repository at this point in the history
* `assert.equal()` -> `assert.strictEqual()`
* add duration to `setTimeout()`

PR-URL: #9663
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Prince John Wesley <princejohnwesley@gmail.com>
  • Loading branch information
Trott authored and addaleax committed Dec 8, 2016
1 parent 3130414 commit 9e4ce6f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion test/parallel/test-async-wrap-check-providers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async_wrap.setupHooks({ init });
async_wrap.enable();


setTimeout(function() { });
setTimeout(function() { }, 1);

fs.stat(__filename, noop);

Expand Down
14 changes: 7 additions & 7 deletions test/parallel/test-async-wrap-disabled-propagate-parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
}
}
Expand All @@ -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);
});
14 changes: 7 additions & 7 deletions test/parallel/test-async-wrap-propagate-parent.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});
}
}
Expand All @@ -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);
});
6 changes: 3 additions & 3 deletions test/parallel/test-async-wrap-throw-from-callback.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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}`);
});
});
}

0 comments on commit 9e4ce6f

Please sign in to comment.