Skip to content

Commit 3c5cf12

Browse files
committed
test: add and assert readable/writable arguments
Currently the readable and writable arguments are not specified in the req.oncomplete method. Adding and asserting that they are always true (which is always the case for TCP). This might seem unnecessary but it can't hurt to have them to pickup any breaking modifications made to ConnectionWrap::AfterConnect in the future. PR-URL: #8815 Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent c8c2544 commit 3c5cf12

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

test/parallel/test-tcp-wrap-connect.js

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,23 +10,23 @@ function makeConnection() {
1010

1111
var req = new TCPConnectWrap();
1212
var err = client.connect(req, '127.0.0.1', this.address().port);
13-
assert.equal(err, 0);
13+
assert.strictEqual(err, 0);
1414

15-
req.oncomplete = function(status, client_, req_) {
16-
assert.equal(0, status);
17-
assert.equal(client, client_);
18-
assert.equal(req, req_);
15+
req.oncomplete = function(status, client_, req_, readable, writable) {
16+
assert.strictEqual(0, status);
17+
assert.strictEqual(client, client_);
18+
assert.strictEqual(req, req_);
19+
assert.strictEqual(true, readable);
20+
assert.strictEqual(true, writable);
1921

20-
console.log('connected');
2122
var shutdownReq = new ShutdownWrap();
2223
var err = client.shutdown(shutdownReq);
23-
assert.equal(err, 0);
24+
assert.strictEqual(err, 0);
2425

2526
shutdownReq.oncomplete = function(status, client_, req_) {
26-
console.log('shutdown complete');
27-
assert.equal(0, status);
28-
assert.equal(client, client_);
29-
assert.equal(shutdownReq, req_);
27+
assert.strictEqual(0, status);
28+
assert.strictEqual(client, client_);
29+
assert.strictEqual(shutdownReq, req_);
3030
shutdownCount++;
3131
client.close();
3232
};
@@ -40,11 +40,9 @@ var endCount = 0;
4040
var shutdownCount = 0;
4141

4242
var server = require('net').Server(function(s) {
43-
console.log('got connection');
4443
connectCount++;
4544
s.resume();
4645
s.on('end', function() {
47-
console.log('got eof');
4846
endCount++;
4947
s.destroy();
5048
server.close();
@@ -54,7 +52,7 @@ var server = require('net').Server(function(s) {
5452
server.listen(0, makeConnection);
5553

5654
process.on('exit', function() {
57-
assert.equal(1, shutdownCount);
58-
assert.equal(1, connectCount);
59-
assert.equal(1, endCount);
55+
assert.strictEqual(1, shutdownCount);
56+
assert.strictEqual(1, connectCount);
57+
assert.strictEqual(1, endCount);
6058
});

0 commit comments

Comments
 (0)