From f9b63b85303583c8ebc2a4068f96b649c906c944 Mon Sep 17 00:00:00 2001 From: Richard Lau Date: Wed, 7 Apr 2021 08:01:27 -0400 Subject: [PATCH] test: update parallel/test-crypto-keygen for OpenSSL 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OpenSSL 3 returns a different error code. PR-URL: https://github.com/nodejs/node/pull/38136 Reviewed-By: James M Snell Reviewed-By: Tobias Nießen Reviewed-By: Filip Skokan --- test/parallel/test-crypto-keygen.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-crypto-keygen.js b/test/parallel/test-crypto-keygen.js index def42f393a2ada..cbf797c0ea2388 100644 --- a/test/parallel/test-crypto-keygen.js +++ b/test/parallel/test-crypto-keygen.js @@ -1325,6 +1325,8 @@ if (!common.hasOpenSSL3) { if (!getCurves().includes(namedCurve)) continue; + const expectedErrorCode = + common.hasOpenSSL3 ? 'ERR_OSSL_MISSING_OID' : 'ERR_OSSL_EC_MISSING_OID'; const params = { namedCurve, publicKeyEncoding: { @@ -1336,11 +1338,11 @@ if (!common.hasOpenSSL3) { assert.throws(() => { generateKeyPairSync('ec', params); }, { - code: 'ERR_OSSL_EC_MISSING_OID' + code: expectedErrorCode }); generateKeyPair('ec', params, common.mustCall((err) => { - assert.strictEqual(err.code, 'ERR_OSSL_EC_MISSING_OID'); + assert.strictEqual(err.code, expectedErrorCode); })); } }