Skip to content

Commit

Permalink
test: change order of assert.strictEquals arguments
Browse files Browse the repository at this point in the history
Fix assert.strictEquals argument order.

Arguments were actual first, expected second, contrary to
the documentation. Now, actual value is first and expected
value is second.

PR-URL: #23600
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
  • Loading branch information
chucktheobald authored and rvagg committed Nov 28, 2018
1 parent 56e862a commit 9d6362d
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/parallel/test-tcp-wrap-listen.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const WriteWrap = process.binding('stream_wrap').WriteWrap;
const server = new TCP(TCPConstants.SOCKET);

const r = server.bind('0.0.0.0', 0);
assert.strictEqual(0, r);
assert.strictEqual(r, 0);
let port = {};
server.getsockname(port);
port = port.port;

server.listen(128);

server.onconnection = (err, client) => {
assert.strictEqual(0, client.writeQueueSize);
assert.strictEqual(client.writeQueueSize, 0);
console.log('got connection');

const maybeCloseClient = () => {
Expand All @@ -32,7 +32,7 @@ server.onconnection = (err, client) => {
if (buffer) {
assert.ok(buffer.length > 0);

assert.strictEqual(0, client.writeQueueSize);
assert.strictEqual(client.writeQueueSize, 0);

const req = new WriteWrap();
req.async = false;
Expand All @@ -42,23 +42,23 @@ server.onconnection = (err, client) => {

console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
// 11 bytes should flush
assert.strictEqual(0, client.writeQueueSize);
assert.strictEqual(client.writeQueueSize, 0);

if (req.async)
req.oncomplete = common.mustCall(done);
else
process.nextTick(done.bind(null, 0, client, req));

function done(status, client_, req_) {
assert.strictEqual(req, client.pendingWrites.shift());
assert.strictEqual(client.pendingWrites.shift(), req);

// Check parameters.
assert.strictEqual(0, status);
assert.strictEqual(client, client_);
assert.strictEqual(req, req_);
assert.strictEqual(status, 0);
assert.strictEqual(client_, client);
assert.strictEqual(req_, req);

console.log(`client.writeQueueSize: ${client.writeQueueSize}`);
assert.strictEqual(0, client.writeQueueSize);
assert.strictEqual(client.writeQueueSize, 0);

maybeCloseClient();
}
Expand All @@ -80,7 +80,7 @@ c.on('connect', common.mustCall(() => { c.end('hello world'); }));

c.setEncoding('utf8');
c.on('data', common.mustCall((d) => {
assert.strictEqual('hello world', d);
assert.strictEqual(d, 'hello world');
}));

c.on('close', () => {
Expand Down

0 comments on commit 9d6362d

Please sign in to comment.