diff options
author | Sam Roberts <vieuxtech@gmail.com> | 2019-02-01 12:21:01 -0800 |
---|---|---|
committer | Sam Roberts <vieuxtech@gmail.com> | 2019-02-06 15:18:41 -0800 |
commit | d597b9193fca7087a6bf1a5eb64c40ac88e852de (patch) | |
tree | 3e4fa6a3dbc2066d93b7cb435fd0ef534f665423 /test | |
parent | b52a8f3507a6df179d0cf2144c88173607926241 (diff) | |
download | android-node-v8-d597b9193fca7087a6bf1a5eb64c40ac88e852de.tar.gz android-node-v8-d597b9193fca7087a6bf1a5eb64c40ac88e852de.tar.bz2 android-node-v8-d597b9193fca7087a6bf1a5eb64c40ac88e852de.zip |
test: use mustCall(), not global state checks
Instead of pushing state into global arrays and checking the results
before exit, use common.mustCall() and make the checks immediately.
PR-URL: https://github.com/nodejs/node/pull/25508
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-tls-socket-constructor-alpn-options-parsing.js | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/test/parallel/test-tls-socket-constructor-alpn-options-parsing.js b/test/parallel/test-tls-socket-constructor-alpn-options-parsing.js index 6b0a23f31b..686f6444ef 100644 --- a/test/parallel/test-tls-socket-constructor-alpn-options-parsing.js +++ b/test/parallel/test-tls-socket-constructor-alpn-options-parsing.js @@ -20,8 +20,6 @@ const fixtures = require('../common/fixtures'); const key = fixtures.readKey('agent1-key.pem'); const cert = fixtures.readKey('agent1-cert.pem'); -const protocols = []; - const server = net.createServer(common.mustCall((s) => { const tlsSocket = new tls.TLSSocket(s, { isServer: true, @@ -32,10 +30,9 @@ const server = net.createServer(common.mustCall((s) => { }); tlsSocket.on('secure', common.mustCall(() => { - protocols.push({ - alpnProtocol: tlsSocket.alpnProtocol, - }); + assert.strictEqual(tlsSocket.alpnProtocol, 'http/1.1'); tlsSocket.end(); + server.close(); })); })); @@ -46,13 +43,7 @@ server.listen(0, common.mustCall(() => { ALPNProtocols: ['h2', 'http/1.1'] }; - tls.connect(alpnOpts, function() { + tls.connect(alpnOpts, common.mustCall(function() { this.end(); - - server.close(); - - assert.deepStrictEqual(protocols, [ - { alpnProtocol: 'http/1.1' }, - ]); - }); + })); })); |