test: refactor test-net-connect-buffer#17710
Conversation
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()`
|
It feels weird that |
|
Actually null is still special also in the binary case. You have to .push(null) on a Readable to terminate. |
|
Right … just seems odd since we also do the same type checks for |
| socket.connect(this.address().port, common.mustCall(() => connected = true)); | ||
|
|
||
| assert.strictEqual(socket.connecting, true); | ||
| assert.strictEqual('opening', socket.readyState); |
There was a problem hiding this comment.
Nit: now that you are here, can you please swap the arguments? There are more below.
| const tcp = net.Server(common.mustCall((s) => { | ||
| tcp.close(); | ||
|
|
||
| console.log('tcp server connection'); |
There was a problem hiding this comment.
I would also remove the remaining console.log(), they don't seem to be very useful.
|
@addaleax that's an oddity of streams backward compatibility. I'm ok in changing that if you want to fire a separate PR. |
|
Landing... |
|
Landed in 7352bf2 |
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
- Use arrow functions, `common.mustCall()` - Remove redundant `console.log()`s/turn them into assertions - Use `common.expectsError()` PR-URL: #17710 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jon Moss <[email protected]>
|
test doesn't pass on 6.x or 8.x (commit lands on both). |
common.mustCall()console.log()s/turn them into assertionscommon.expectsError()Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passesAffected core subsystem(s)
test/net