From 05101e69cafc21aaf2601143a684553945742eca Mon Sep 17 00:00:00 2001 From: Anna Henningsen Date: Sat, 23 Dec 2017 09:00:43 +0100 Subject: [PATCH] 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 Reviewed-By: Ruben Bridgewater Reviewed-By: Colin Ihrig Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-tls-securepair-fiftharg.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test/parallel/test-tls-securepair-fiftharg.js b/test/parallel/test-tls-securepair-fiftharg.js index 364b70aa76b0ca..185dc43d941ca6 100644 --- a/test/parallel/test-tls-securepair-fiftharg.js +++ b/test/parallel/test-tls-securepair-fiftharg.js @@ -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); -});