From 808e5c72b61e96bdb098298acef5739fbb4215b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=93=8D=E9=A9=AC?= Date: Mon, 13 May 2024 03:46:19 +0800 Subject: [PATCH] test, crypto: use correct object on assert MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test case for KeyObject does not really test the creation of asymmetric cryptographic keys using jwk because of a misspelling of the variable. PR-URL: https://github.com/nodejs/node/pull/51820 Reviewed-By: Luigi Pinca Reviewed-By: Vinícius Lourenço Claro Cardoso Reviewed-By: Tobias Nießen --- test/parallel/test-crypto-key-objects.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/test/parallel/test-crypto-key-objects.js b/test/parallel/test-crypto-key-objects.js index 84e32de6ba1ae9..f5271f16d346c0 100644 --- a/test/parallel/test-crypto-key-objects.js +++ b/test/parallel/test-crypto-key-objects.js @@ -169,16 +169,16 @@ const privateDsa = fixtures.readKey('dsa_private_encrypted_1025.pem', assert.strictEqual(derivedPublicKey.symmetricKeySize, undefined); const publicKeyFromJwk = createPublicKey({ key: publicJwk, format: 'jwk' }); - assert.strictEqual(publicKey.type, 'public'); - assert.strictEqual(publicKey.toString(), '[object KeyObject]'); - assert.strictEqual(publicKey.asymmetricKeyType, 'rsa'); - assert.strictEqual(publicKey.symmetricKeySize, undefined); + assert.strictEqual(publicKeyFromJwk.type, 'public'); + assert.strictEqual(publicKeyFromJwk.toString(), '[object KeyObject]'); + assert.strictEqual(publicKeyFromJwk.asymmetricKeyType, 'rsa'); + assert.strictEqual(publicKeyFromJwk.symmetricKeySize, undefined); const privateKeyFromJwk = createPrivateKey({ key: jwk, format: 'jwk' }); - assert.strictEqual(privateKey.type, 'private'); - assert.strictEqual(privateKey.toString(), '[object KeyObject]'); - assert.strictEqual(privateKey.asymmetricKeyType, 'rsa'); - assert.strictEqual(privateKey.symmetricKeySize, undefined); + assert.strictEqual(privateKeyFromJwk.type, 'private'); + assert.strictEqual(privateKeyFromJwk.toString(), '[object KeyObject]'); + assert.strictEqual(privateKeyFromJwk.asymmetricKeyType, 'rsa'); + assert.strictEqual(privateKeyFromJwk.symmetricKeySize, undefined); // It should also be possible to import an encrypted private key as a public // key.