Skip to content

Commit

Permalink
test: refactor test-tls-securepair-fiftharg
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
addaleax committed Dec 27, 2017
1 parent 46510f5 commit b343671
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions test/parallel/test-tls-securepair-fiftharg.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,13 @@ 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');
})
});

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

pair.encrypted.write(sslHello);

process.on('exit', function() {
assert.strictEqual('www.google.com', catchedServername);
});

0 comments on commit b343671

Please sign in to comment.