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

1 file changed

Lines changed: 2 additions & 7 deletions

File tree

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

Lines changed: 2 additions & 7 deletions
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-
letcatchedServername;
1413
constpair=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
constsslHello=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)