Skip to content

Commit af8e27d

Browse files
sreepurnajastiMylesBorins
authored andcommitted
test: Use common.mustCall in http test
PR-URL: #17487 Refs: #17169 Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Anatoli Papirovski <[email protected]>
1 parent 7f2764d commit af8e27d

File tree

1 file changed

+4
-13
lines changed

1 file changed

+4
-13
lines changed
Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,24 @@
11
'use strict';
2-
require('../common');
3-
constassert=require('assert');
2+
constcommon=require('../common');
43
consthttp=require('http');
54
constnet=require('net');
65

76
constCOUNT=10;
87

9-
letreceived=0;
10-
11-
constserver=http.createServer(function(req,res){
8+
constserver=http.createServer(common.mustCall((req,res)=>{
129
// Close the server, we have only one TCP connection anyway
13-
if(received++===0)
14-
server.close();
15-
10+
server.close();
1611
res.writeHead(200);
1712
res.write('data');
1813

1914
setTimeout(function(){
2015
res.end();
2116
},(Math.random()*100)|0);
22-
}).listen(0,function(){
17+
},COUNT)).listen(0,function(){
2318
consts=net.connect(this.address().port);
2419

2520
constbig='GET / HTTP/1.0\r\n\r\n'.repeat(COUNT);
2621

2722
s.write(big);
2823
s.resume();
2924
});
30-
31-
process.on('exit',function(){
32-
assert.strictEqual(received,COUNT);
33-
});

0 commit comments

Comments
(0)