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); })); } }