Skip to content

Commit 0a3107b

Browse files
committed
test: test private key must be defined
This test was excluded because the precondition wasn't hit when calling `keyring.onDecrypt` (I think due to another precondition somewhere else). It might be a bit sneaky to call the "private" method (`_unwrapKey`) in the tests, but it hits the precondition we're trying to test more directly.
1 parent 310a767 commit 0a3107b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

modules/raw-rsa-keyring-node/test/raw_rsa_keyring_node.test.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ describe('RawRsaKeyringNode encrypt/decrypt', () => {
168168
return expect(keyring.onEncrypt(material)).to.rejectedWith(Error)
169169
})
170170

171-
xit('Precondition: Private key must be defined to support decrypt.', async () => {
171+
it('Precondition: Private key must be defined to support decrypt.', async () => {
172172
const keyring = new RawRsaKeyringNode({
173173
rsaKey: { publicKey: publicPem },
174174
keyName,
@@ -177,7 +177,6 @@ describe('RawRsaKeyringNode encrypt/decrypt', () => {
177177

178178
const suite = new NodeAlgorithmSuite(AlgorithmSuiteIdentifier.ALG_AES256_GCM_IV12_TAG16_HKDF_SHA256)
179179
const material = new NodeDecryptionMaterial(suite, {})
180-
await keyring.onDecrypt(material, [encryptedDataKey])
181-
return expect(keyring.onDecrypt(material, [encryptedDataKey])).to.rejectedWith(Error)
180+
return expect(keyring._unwrapKey(material, encryptedDataKey)).to.rejectedWith(Error)
182181
})
183182
})

0 commit comments

Comments
 (0)