diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-12-23 09:00:43 +0100 |
---|---|---|
committer | Myles Borins <mylesborins@google.com> | 2018-02-12 19:28:27 -0500 |
commit | b3e625d67a86a66e6a250e856f5ab6075f1a420d (patch) | |
tree | c579cc0f0fa015d858cb8fb68e96460e3a0d78ae | |
parent | 32f528a92e399b24f5cc3fbb264b6d5fb2f3138a (diff) | |
download | node-new-b3e625d67a86a66e6a250e856f5ab6075f1a420d.tar.gz |
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>
-rw-r--r-- | test/parallel/test-tls-securepair-fiftharg.js | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js index 52f8b6c0ee..289e6dd7f4 100644 --- a/test/parallel/test-tls-securepair-fiftharg.js +++ b/test/parallel/test-tls-securepair-fiftharg.js @@ -10,10 +10,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'); }) }); @@ -21,7 +20,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); -}); |