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 parameters order #23581

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/known_issues/test-http-path-contains-unicode.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const http = require('http');

const expected = '/café🐶';

assert.strictEqual('/caf\u{e9}\u{1f436}', expected);
assert.strictEqual(expected, '/caf\u{e9}\u{1f436}');
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure that this one is correct?

Copy link
Member

Choose a reason for hiding this comment

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

@cjihrig I think both the code and the change are correct… are you worried about anything in particular?

Copy link
Contributor

Choose a reason for hiding this comment

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

The parameter order is actual, expected. It looks like that was already correct. The variable is even named expected 😄

Copy link
Member

Choose a reason for hiding this comment

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

Oh, right. I think that is because expected is what we expect later down here in the test, and this is just double-checking that we are expecting the right thing? 😄

Copy link
Contributor

Choose a reason for hiding this comment

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

I guess maybe it's an edge case or just poorly named. Either way, I won't block this.

Copy link
Member

Choose a reason for hiding this comment

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

I guess the problem is with the overloaded usage of the variable expected, with name perfectly fitting for the client-server case while causing confusion in the assertion.


const server = http.createServer(common.mustCall(function(req, res) {
assert.strictEqual(req.url, expected);
Expand Down
2 changes: 1 addition & 1 deletion test/pummel/test-net-timeout.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ echo_server.listen(common.PORT, function() {
});

client.on('data', function(chunk) {
assert.strictEqual('hello\r\n', chunk);
assert.strictEqual(chunk, 'hello\r\n');
if (exchanges++ < 5) {
setTimeout(function() {
console.log('client write "hello"');
Expand Down