Skip to content

Commit b59cf58

Browse files
TrottMylesBorins
authored andcommitted
test: refactor test-async-wrap-*
* `assert.equal()` -> `assert.strictEqual()` * add duration to `setTimeout()` PR-URL: #9663 Reviewed-By: Ben Noordhuis <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Santiago Gimeno <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Prince John Wesley <[email protected]>
1 parent 57cc5cb commit b59cf58

4 files changed

+18
-18
lines changed

test/parallel/test-async-wrap-check-providers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async_wrap.setupHooks({ init });
4141
async_wrap.enable();
4242

4343

44-
setTimeout(function() { });
44+
setTimeout(function() { }, 1);
4545

4646
fs.stat(__filename, noop);
4747

test/parallel/test-async-wrap-disabled-propagate-parent.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) {
1818
cntr++;
1919
// Cannot assert in init callback or will abort.
2020
process.nextTick(() => {
21-
assert.equal(providers[type], 'TCPWRAP');
22-
assert.equal(parentUid, server._handle[uidSymbol],
23-
'server uid doesn\'t match parent uid');
24-
assert.equal(parentHandle, server._handle,
25-
'server handle doesn\'t match parent handle');
26-
assert.equal(this, client._handle, 'client doesn\'t match context');
21+
assert.strictEqual(providers[type], 'TCPWRAP');
22+
assert.strictEqual(parentUid, server._handle[uidSymbol],
23+
'server uid doesn\'t match parent uid');
24+
assert.strictEqual(parentHandle, server._handle,
25+
'server handle doesn\'t match parent handle');
26+
assert.strictEqual(this, client._handle, 'client doesn\'t match context');
2727
});
2828
}
2929
}
@@ -48,5 +48,5 @@ async_wrap.disable();
4848

4949
process.on('exit', function() {
5050
// init should have only been called once with a parent.
51-
assert.equal(cntr, 1);
51+
assert.strictEqual(cntr, 1);
5252
});

test/parallel/test-async-wrap-propagate-parent.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ function init(uid, type, parentUid, parentHandle) {
1818
cntr++;
1919
// Cannot assert in init callback or will abort.
2020
process.nextTick(() => {
21-
assert.equal(providers[type], 'TCPWRAP');
22-
assert.equal(parentUid, server._handle[uidSymbol],
23-
'server uid doesn\'t match parent uid');
24-
assert.equal(parentHandle, server._handle,
25-
'server handle doesn\'t match parent handle');
26-
assert.equal(this, client._handle, 'client doesn\'t match context');
21+
assert.strictEqual(providers[type], 'TCPWRAP');
22+
assert.strictEqual(parentUid, server._handle[uidSymbol],
23+
'server uid doesn\'t match parent uid');
24+
assert.strictEqual(parentHandle, server._handle,
25+
'server handle doesn\'t match parent handle');
26+
assert.strictEqual(this, client._handle, 'client doesn\'t match context');
2727
});
2828
}
2929
}
@@ -47,5 +47,5 @@ const server = net.createServer(function(c) {
4747

4848
process.on('exit', function() {
4949
// init should have only been called once with a parent.
50-
assert.equal(cntr, 1);
50+
assert.strictEqual(cntr, 1);
5151
});

test/parallel/test-async-wrap-throw-from-callback.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ if (typeof process.argv[2] === 'string') {
4040
} else {
4141

4242
process.on('exit', (code) => {
43-
assert.equal(msgCalled, callbacks.length);
44-
assert.equal(msgCalled, msgReceived);
43+
assert.strictEqual(msgCalled, callbacks.length);
44+
assert.strictEqual(msgCalled, msgReceived);
4545
});
4646

4747
callbacks.forEach((item) => {
@@ -58,7 +58,7 @@ if (typeof process.argv[2] === 'string') {
5858
if (errstring.includes('Error: ' + item))
5959
msgReceived++;
6060

61-
assert.equal(code, 1, `${item} closed with code ${code}`);
61+
assert.strictEqual(code, 1, `${item} closed with code ${code}`);
6262
});
6363
});
6464
}

0 commit comments

Comments
 (0)