test: correct labelling of asserts errors

PR-URL: https://github.com/nodejs/node/pull/23531
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
nofwayy 2018-10-12 10:25:33 -07:00 committed by Ruben Bridgewater
parent 244180826e
commit a24027f9ee
No known key found for this signature in database
GPG Key ID: F07496B3EB3C1762

View File

@ -57,12 +57,12 @@ const proxy = net.createServer((clientSocket) => {
clientSocket.on('data', (chunk) => { clientSocket.on('data', (chunk) => {
if (!serverSocket) { if (!serverSocket) {
// Verify the CONNECT request // Verify the CONNECT request
assert.strictEqual(`CONNECT localhost:${server.address().port} ` + assert.strictEqual(chunk.toString(),
`CONNECT localhost:${server.address().port} ` +
'HTTP/1.1\r\n' + 'HTTP/1.1\r\n' +
'Proxy-Connections: keep-alive\r\n' + 'Proxy-Connections: keep-alive\r\n' +
`Host: localhost:${proxy.address().port}\r\n` + `Host: localhost:${proxy.address().port}\r\n` +
'Connection: close\r\n\r\n', 'Connection: close\r\n\r\n');
chunk.toString());
console.log('PROXY: got CONNECT request'); console.log('PROXY: got CONNECT request');
console.log('PROXY: creating a tunnel'); console.log('PROXY: creating a tunnel');
@ -126,7 +126,7 @@ proxy.listen(0, common.mustCall(() => {
} }
function onConnect(res, socket, header) { function onConnect(res, socket, header) {
assert.strictEqual(200, res.statusCode); assert.strictEqual(res.statusCode, 200);
console.log('CLIENT: got CONNECT response'); console.log('CLIENT: got CONNECT response');
// detach the socket // detach the socket
@ -149,10 +149,10 @@ proxy.listen(0, common.mustCall(() => {
agent: false, agent: false,
rejectUnauthorized: false rejectUnauthorized: false
}, (res) => { }, (res) => {
assert.strictEqual(200, res.statusCode); assert.strictEqual(res.statusCode, 200);
res.on('data', common.mustCall((chunk) => { res.on('data', common.mustCall((chunk) => {
assert.strictEqual('hello world\n', chunk.toString()); assert.strictEqual(chunk.toString(), 'hello world\n');
console.log('CLIENT: got HTTPS response'); console.log('CLIENT: got HTTPS response');
gotRequest = true; gotRequest = true;
})); }));