Skip to content

Commit a220170

Browse files
Trottaddaleax
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 c4f33b4 commit a220170

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
@@ -46,7 +46,7 @@ async_wrap.setupHooks({ init });
4646
async_wrap.enable();
4747

4848

49-
setTimeout(function() { });
49+
setTimeout(function() { }, 1);
5050

5151
fs.stat(__filename, noop);
5252

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
@@ -49,8 +49,8 @@ if (typeof process.argv[2] === 'string') {
4949
} else {
5050

5151
process.on('exit', (code) => {
52-
assert.equal(msgCalled, callbacks.length);
53-
assert.equal(msgCalled, msgReceived);
52+
assert.strictEqual(msgCalled, callbacks.length);
53+
assert.strictEqual(msgCalled, msgReceived);
5454
});
5555

5656
callbacks.forEach((item) => {
@@ -67,7 +67,7 @@ if (typeof process.argv[2] === 'string') {
6767
if (errstring.includes('Error: ' + item))
6868
msgReceived++;
6969

70-
assert.equal(code, 1, `${item} closed with code ${code}`);
70+
assert.strictEqual(code, 1, `${item} closed with code ${code}`);
7171
});
7272
});
7373
}

0 commit comments

Comments
 (0)