fix account tests

This commit is contained in:
Pavel Prichodko 2022-06-09 14:44:45 +02:00 committed by Felicio Mununga
parent 373d87e148
commit 51cce6c084
No known key found for this signature in database
GPG Key ID: 0EB8D75C775AB6F1
1 changed files with 6 additions and 3 deletions

View File

@ -11,9 +11,12 @@ describe('Account', () => {
const message = utf8ToBytes('123')
const messageHash = keccak256(message)
const signature = await account.signMessage(message)
const signature = await account.sign(message)
const signatureWithoutRecoveryId = signature.slice(0, -1)
expect(secp.verify(signature, messageHash, account.publicKey)).toBeTruthy()
expect(
secp.verify(signatureWithoutRecoveryId, messageHash, account.publicKey)
).toBeTruthy()
})
it('should not verify signature with different message', async () => {
@ -22,7 +25,7 @@ describe('Account', () => {
const message = utf8ToBytes('123')
const messageHash = keccak256(message)
const signature = await account.signMessage(utf8ToBytes('abc'))
const signature = await account.sign(utf8ToBytes('abc'))
expect(secp.verify(signature, messageHash, account.publicKey)).toBeFalsy()
})