MCPcopy Index your code
hub / github.com/nodejs/node / testLib

Function testLib

test/parallel/test-tls-net-connect-prefer-path.js:40–63  ·  view source on GitHub ↗
(lib, cb)

Source from the content-addressed store, hash-verified

38}
39
40function testLib(lib, cb) {
41 mkServer(lib, true, common.mustCall((tcpServer) => {
42 mkServer(lib, false, common.mustCall((unixServer) => {
43 const client = lib.connect({
44 path: unixServer.address(),
45 port: tcpServer.address().port,
46 host: 'localhost',
47 rejectUnauthorized: false
48 }, common.mustCall(() => {
49 const bufs = [];
50 client.on('data', common.mustCall((d) => {
51 bufs.push(d);
52 }));
53 client.on('end', common.mustCall(() => {
54 const resp = Buffer.concat(bufs).toString();
55 assert.strictEqual(resp, `${libName(lib)}:${unixServer.address()}`);
56 tcpServer.close();
57 unixServer.close();
58 cb();
59 }));
60 }));
61 }));
62 }));
63}
64
65testLib(net, common.mustCall(() => testLib(tls, common.mustCall())));

Calls 10

mkServerFunction · 0.85
libNameFunction · 0.85
concatMethod · 0.80
cbFunction · 0.70
connectMethod · 0.65
addressMethod · 0.65
closeMethod · 0.65
onMethod · 0.45
pushMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected