Skip to content

Commit 3829e99

Browse files
jehainesjasnell
authored andcommitted
test: fix order of values in test assertions
Have actual first, expected second. PR-URL: #23450 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
1 parent 4ed1fba commit 3829e99

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

test/parallel/test-http-server.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -37,23 +37,23 @@ const server = http.createServer(function(req, res) {
3737
req.id = request_number++;
3838

3939
if (req.id === 0) {
40-
assert.strictEqual('GET', req.method);
41-
assert.strictEqual('/hello', url.parse(req.url).pathname);
42-
assert.strictEqual('world', qs.parse(url.parse(req.url).query).hello);
43-
assert.strictEqual('b==ar', qs.parse(url.parse(req.url).query).foo);
40+
assert.strictEqual(req.method, 'GET');
41+
assert.strictEqual(url.parse(req.url).pathname, '/hello');
42+
assert.strictEqual(qs.parse(url.parse(req.url).query).hello, 'world');
43+
assert.strictEqual(qs.parse(url.parse(req.url).query).foo, 'b==ar');
4444
}
4545

4646
if (req.id === 1) {
47-
assert.strictEqual('POST', req.method);
48-
assert.strictEqual('/quit', url.parse(req.url).pathname);
47+
assert.strictEqual(req.method, 'POST');
48+
assert.strictEqual(url.parse(req.url).pathname, '/quit');
4949
}
5050

5151
if (req.id === 2) {
52-
assert.strictEqual('foo', req.headers['x-x']);
52+
assert.strictEqual(req.headers['x-x'], 'foo');
5353
}
5454

5555
if (req.id === 3) {
56-
assert.strictEqual('bar', req.headers['x-x']);
56+
assert.strictEqual(req.headers['x-x'], 'bar');
5757
this.close();
5858
}
5959

@@ -112,14 +112,14 @@ server.on('listening', function() {
112112
});
113113

114114
process.on('exit', function() {
115-
assert.strictEqual(4, request_number);
116-
assert.strictEqual(4, requests_sent);
115+
assert.strictEqual(request_number, 4);
116+
assert.strictEqual(requests_sent, 4);
117117

118118
const hello = new RegExp('/hello');
119119
assert.ok(hello.test(server_response));
120120

121121
const quit = new RegExp('/quit');
122122
assert.ok(quit.test(server_response));
123123

124-
assert.strictEqual(true, client_got_eof);
124+
assert.strictEqual(client_got_eof, true);
125125
});

0 commit comments

Comments
 (0)