Skip to content

Commit

Permalink
test: use assert.{s,deepS}trictEqual()
Browse files Browse the repository at this point in the history
Use `asset.strictEqual()` and `asset.deepStrictEqual()` in
`test/parallel/test-tls-set-sigalgs.js`.

PR-URL: nodejs#54208
Reviewed-By: Jake Yuesong Li <[email protected]>
Reviewed-By: Daeyeon Jeong <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
  • Loading branch information
sonsurim authored and richardlau committed Sep 27, 2024
1 parent 1320fb9 commit e9e3306
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions test/parallel/test-tls-set-sigalgs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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);
}
}

Expand All @@ -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');

0 comments on commit e9e3306

Please sign in to comment.