Skip to content
Closed
Changes from 1 commit
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
Next Next commit
codeandlearn: use strictEqual instead of equal
  • Loading branch information
ftatieze committed Dec 28, 2016
commit 40ecf79377a10e0718a565662a4e58da76ad7cf3
30 changes: 15 additions & 15 deletions test/parallel/test-http-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@ var server = http.createServer(function(req, res) {
req.id = request_number++;

if (req.id === 0) {
assert.equal('GET', req.method);
assert.equal('/hello', url.parse(req.url).pathname);
assert.equal('world', qs.parse(url.parse(req.url).query).hello);
assert.equal('b==ar', qs.parse(url.parse(req.url).query).foo);
assert.strictEqual('GET', req.method);
assert.strictEqual('/hello', url.parse(req.url).pathname);
assert.strictEqual('world', qs.parse(url.parse(req.url).query).hello);
assert.strictEqual('b==ar', qs.parse(url.parse(req.url).query).foo);
}

if (req.id === 1) {
assert.equal('POST', req.method);
assert.equal('/quit', url.parse(req.url).pathname);
assert.strictEqual('POST', req.method);
assert.strictEqual('/quit', url.parse(req.url).pathname);
}

if (req.id === 2) {
assert.equal('foo', req.headers['x-x']);
assert.strictEqual('foo', req.headers['x-x']);
}

if (req.id === 3) {
assert.equal('bar', req.headers['x-x']);
assert.strictEqual('bar', req.headers['x-x']);
this.close();
}

Expand Down Expand Up @@ -75,7 +75,7 @@ server.on('listening', function() {
// you set server.httpAllowHalfOpen=true, which we've done
// above.
c.end();
assert.equal(c.readyState, 'readOnly');
assert.strictEqual(c.readyState, 'readOnly');
requests_sent += 2;
}

Expand All @@ -86,19 +86,19 @@ server.on('listening', function() {
});

c.on('close', function() {
assert.equal(c.readyState, 'closed');
assert.strictEqual(c.readyState, 'closed');
});
});

process.on('exit', function() {
assert.equal(4, request_number);
assert.equal(4, requests_sent);
assert.strictEqual(4, request_number);
assert.strictEqual(4, requests_sent);

var hello = new RegExp('/hello');
assert.equal(true, hello.exec(server_response) != null);
assert.strictEqual(true, hello.exec(server_response) != null);
Copy link
Copy Markdown
Contributor

@mscdex mscdex Dec 28, 2016

Choose a reason for hiding this comment

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

Maybe we can change this assertion and the one below to instead be like:

assert.notEqual(null, hello.exec(server_response));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I agree. Making the changes now.


var quit = new RegExp('/quit');
assert.equal(true, quit.exec(server_response) != null);
assert.strictEqual(true, quit.exec(server_response) != null);

assert.equal(true, client_got_eof);
assert.strictEqual(true, client_got_eof);
});