Skip to content

Commit b3e625d

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 <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 32f528a commit b3e625d

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
@@ -10,18 +10,13 @@ const sslcontext = tls.createSecureContext({
1010
key: fixtures.readSync('test_key.pem')
1111
});
1212

13-
let catchedServername;
1413
const pair = tls.createSecurePair(sslcontext, true, false, false, {
15-
SNICallback: common.mustCall(function(servername, cb) {
16-
catchedServername = servername;
14+
SNICallback: common.mustCall((servername, cb) => {
15+
assert.strictEqual(servername, 'www.google.com');
1716
})
1817
});
1918

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

2322
pair.encrypted.write(sslHello);
24-
25-
process.on('exit', function() {
26-
assert.strictEqual('www.google.com', catchedServername);
27-
});

0 commit comments

Comments
 (0)