Skip to content

Commit

Permalink
test: switch actual value argument and expected in deepStrictEqual call
Browse files Browse the repository at this point in the history
Replace deepStrictEqual call to have actual value as the first argument
and the expected value as the second.

Change expectedRecvData definition in single place.

PR-URL: #27888
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Ujjwal Sharma <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
  • Loading branch information
VetoS88 authored and targos committed May 28, 2019
1 parent 531669b commit f5bb1b3
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions test/parallel/test-http-upgrade-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ const http = require('http');
const net = require('net');
const Countdown = require('../common/countdown');

const expectedRecvData = 'nurtzo';

// Create a TCP server
const srv = net.createServer(function(c) {
c.on('data', function(d) {
Expand All @@ -39,7 +41,7 @@ const srv = net.createServer(function(c) {
c.write('connection: upgrade\r\n');
c.write('upgrade: websocket\r\n');
c.write('\r\n');
c.write('nurtzo');
c.write(expectedRecvData);
});

c.on('end', function() {
Expand Down Expand Up @@ -77,7 +79,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
});

socket.on('close', common.mustCall(function() {
assert.strictEqual(recvData.toString(), 'nurtzo');
assert.strictEqual(recvData.toString(), expectedRecvData);
}));

console.log(res.headers);
Expand All @@ -86,8 +88,7 @@ srv.listen(0, '127.0.0.1', common.mustCall(function() {
connection: 'upgrade',
upgrade: 'websocket'
};
assert.deepStrictEqual(expectedHeaders, res.headers);

assert.deepStrictEqual(res.headers, expectedHeaders);
socket.end();
countdown.dec();
}));
Expand Down

0 comments on commit f5bb1b3

Please sign in to comment.