From e9e330642625d073c10e93a971ebc75ee94d70a6 Mon Sep 17 00:00:00 2001 From: Sonny <47546413+sonsurim@users.noreply.github.com> Date: Sun, 4 Aug 2024 16:03:24 +0900 Subject: [PATCH] test: use assert.{s,deepS}trictEqual() Use `asset.strictEqual()` and `asset.deepStrictEqual()` in `test/parallel/test-tls-set-sigalgs.js`. PR-URL: https://github.com/nodejs/node/pull/54208 Reviewed-By: Jake Yuesong Li Reviewed-By: Daeyeon Jeong Reviewed-By: Trivikram Kamat Reviewed-By: Benjamin Gruenbaum Reviewed-By: Yagiz Nizipli --- test/parallel/test-tls-set-sigalgs.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/test/parallel/test-tls-set-sigalgs.js b/test/parallel/test-tls-set-sigalgs.js index 59dc2ca0c786cf..ffe950a0d21f86 100644 --- a/test/parallel/test-tls-set-sigalgs.js +++ b/test/parallel/test-tls-set-sigalgs.js @@ -9,13 +9,6 @@ const { assert, connect, keys } = require(fixtures.path('tls-connect')); -function assert_arrays_equal(left, right) { - assert.strictEqual(left.length, right.length); - for (let i = 0; i < left.length; i++) { - assert.strictEqual(left[i], right[i]); - } -} - function test(csigalgs, ssigalgs, shared_sigalgs, cerr, serr) { assert(shared_sigalgs || serr || cerr, 'test missing any expectations'); connect({ @@ -43,16 +36,19 @@ function test(csigalgs, ssigalgs, shared_sigalgs, cerr, serr) { assert.ifError(pair.client.err); assert(pair.server.conn); assert(pair.client.conn); - assert_arrays_equal(pair.server.conn.getSharedSigalgs(), shared_sigalgs); + assert.deepStrictEqual( + pair.server.conn.getSharedSigalgs(), + shared_sigalgs + ); } else { if (serr) { assert(pair.server.err); - assert(pair.server.err.code, serr); + assert.strictEqual(pair.server.err.code, serr); } if (cerr) { assert(pair.client.err); - assert(pair.client.err.code, cerr); + assert.strictEqual(pair.client.err.code, cerr); } } @@ -68,7 +64,9 @@ test('RSA-PSS+SHA256:RSA-PSS+SHA512:ECDSA+SHA256', // Do not have shared sigalgs. test('RSA-PSS+SHA384', 'ECDSA+SHA256', - undefined, 'ECONNRESET', 'ERR_SSL_NO_SHARED_SIGNATURE_ALGORITMS'); + undefined, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', + 'ERR_SSL_NO_SHARED_SIGNATURE_ALGORITHMS'); test('RSA-PSS+SHA384:ECDSA+SHA256', 'ECDSA+SHA384:RSA-PSS+SHA256', - undefined, 'ECONNRESET', 'ERR_SSL_NO_SHARED_SIGNATURE_ALGORITMS'); + undefined, 'ERR_SSL_SSLV3_ALERT_HANDSHAKE_FAILURE', + 'ERR_SSL_NO_SHARED_SIGNATURE_ALGORITHMS');