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: https://github.com/nodejs/node/pull/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>
This commit is contained in:
parent
46510f54be
commit
b34367150e
@ -13,10 +13,9 @@ const sslcontext = tls.createSecureContext({
|
||||
key: fixtures.readSync('test_key.pem')
|
||||
});
|
||||
|
||||
let catchedServername;
|
||||
const pair = tls.createSecurePair(sslcontext, true, false, false, {
|
||||
SNICallback: common.mustCall(function(servername, cb) {
|
||||
catchedServername = servername;
|
||||
SNICallback: common.mustCall((servername, cb) => {
|
||||
assert.strictEqual(servername, 'www.google.com');
|
||||
})
|
||||
});
|
||||
|
||||
@ -24,7 +23,3 @@ const pair = tls.createSecurePair(sslcontext, true, false, false, {
|
||||
const sslHello = fixtures.readSync('google_ssl_hello.bin');
|
||||
|
||||
pair.encrypted.write(sslHello);
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.strictEqual('www.google.com', catchedServername);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user