Skip to content

Commit

Permalink
test: fix unit test of create key pair
Browse files Browse the repository at this point in the history
  • Loading branch information
agentR47@gmail.com committed Feb 11, 2024
1 parent 0a6e8e3 commit 8b516a8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/api/src/common/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,12 @@ describe('util', () => {
const differenetKeyPair = createKeyPair()
const plainText = 'hello world'
const encrypted = await encrypt(keyPair.publicKey, plainText)
const decrypted = await decrypt(differenetKeyPair.privateKey, encrypted)
expect(decrypted).toThrow()
try {
await decrypt(differenetKeyPair.privateKey, encrypted)
} catch (e) {
expect(e).toBeDefined()
expect(e.message).toEqual('Bad MAC')
}
})

it('should exclude fields', () => {
Expand Down

0 comments on commit 8b516a8

Please sign in to comment.