Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: fix assert.strictEqual() parameter order #23564

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 11 additions & 11 deletions test/parallel/test-tcp-wrap-connect.js
Expand Up @@ -18,20 +18,20 @@ function makeConnection() {
assert.strictEqual(err, 0);

req.oncomplete = function(status, client_, req_, readable, writable) {
assert.strictEqual(0, status);
assert.strictEqual(client, client_);
assert.strictEqual(req, req_);
assert.strictEqual(true, readable);
assert.strictEqual(true, writable);
assert.strictEqual(status, 0);
assert.strictEqual(client_, client);
assert.strictEqual(req_, req);
assert.strictEqual(readable, true);
assert.strictEqual(writable, true);

const shutdownReq = new ShutdownWrap();
const err = client.shutdown(shutdownReq);
assert.strictEqual(err, 0);

shutdownReq.oncomplete = function(status, client_, error) {
assert.strictEqual(0, status);
assert.strictEqual(client, client_);
assert.strictEqual(error, undefined);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this order be preserved?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @trivikr , would you explain further you comment? I believe that the order here is already changed, unless you meant something else. I didn't understand before, but now I got what you said. I have a question, though: why would it be preserved?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad, the comment was for line 34.
The strictEqual assertions should follow the order actual-value -> expected-value, where error is actual value, while undefined is expected value.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed while landing.

assert.strictEqual(status, 0);
assert.strictEqual(client_, client);
assert.strictEqual(undefined, error);
shutdownCount++;
client.close();
};
Expand All @@ -55,7 +55,7 @@ const server = require('net').Server(function(s) {
server.listen(0, makeConnection);

process.on('exit', function() {
assert.strictEqual(1, shutdownCount);
assert.strictEqual(1, connectCount);
assert.strictEqual(1, endCount);
assert.strictEqual(shutdownCount, 1);
assert.strictEqual(connectCount, 1);
assert.strictEqual(endCount, 1);
});