Skip to content

Commit

Permalink
fix: update flaky test
Browse files Browse the repository at this point in the history
Updated flaky test
  • Loading branch information
Alex Risch authored and Alex Risch committed May 8, 2024
1 parent c255ac3 commit fbd3bc6
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/js-sdk/test/Contacts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,20 +258,25 @@ describe('Contacts', () => {
expect(isDenied).toBeTruthy()
})

it('consent proof correctly validates', async () => {
it('consent proof should not approve for invalid signature', async () => {
const bo = await newLocalHostClient()
const wallet = newWallet()
const keySigner = new WalletSigner(wallet)
const alixAddress = await keySigner.wallet.getAddress()
const alix = await Client.create(wallet, {
env: 'local',
})
const initialIsAllowed = await alix.contacts.isAllowed(bo.address)
expect(
initialIsAllowed,
'Should be not be allowed by default'
).toBeFalsy()
const timestamp = Date.now()
const consentMessage = createConsentMessage(bo.address, timestamp + 1)
const consentMessage = createConsentMessage(bo.address, timestamp)
const signedMessage = await keySigner.wallet.signMessage(consentMessage)
const consentProofPayload = invitation.ConsentProofPayload.fromPartial({
signature: signedMessage,
timestamp,
timestamp: timestamp + 1000,
payloadVersion:
invitation.ConsentProofPayloadVersion.CONSENT_PROOF_PAYLOAD_VERSION_1,
})
Expand Down

0 comments on commit fbd3bc6

Please sign in to comment.