Skip to content

Commit 1dd859d

Browse files
addaleaxMylesBorins
authored andcommitted
test: refactor test-tls-securepair-fiftharg
Assert the server name directly in the `SNICallback`, since `common.mustCall()` already guarantees that the callback is called exactly once, making `process.on('exit')` unnecessary. PR-URL: #17836 Reviewed-By: Timothy Gu <[email protected]> Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Jon Moss <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent e69ea78 commit 1dd859d

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

test/parallel/test-tls-securepair-fiftharg.js

+2-7
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,13 @@ const sslcontext = tls.createSecureContext({
1313
key: fixtures.readSync('test_key.pem')
1414
});
1515

16-
let catchedServername;
1716
const pair = tls.createSecurePair(sslcontext, true, false, false, {
18-
SNICallback: common.mustCall(function(servername, cb) {
19-
catchedServername = servername;
17+
SNICallback: common.mustCall((servername, cb) => {
18+
assert.strictEqual(servername, 'www.google.com');
2019
})
2120
});
2221

2322
// captured traffic from browser's request to https://www.google.com
2423
const sslHello = fixtures.readSync('google_ssl_hello.bin');
2524

2625
pair.encrypted.write(sslHello);
27-
28-
process.on('exit', function() {
29-
assert.strictEqual('www.google.com', catchedServername);
30-
});

0 commit comments

Comments
 (0)