Skip to content

Commit 05101e6

Browse files
addaleaxgibfahn
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 <timothygu99@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 990d22e commit 05101e6

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)