From fbd3bc6e3c3e7de4f8187538dc3b62c228cc5bf7 Mon Sep 17 00:00:00 2001 From: Alex Risch Date: Wed, 8 May 2024 12:34:08 -0600 Subject: [PATCH] fix: update flaky test Updated flaky test --- packages/js-sdk/test/Contacts.test.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/js-sdk/test/Contacts.test.ts b/packages/js-sdk/test/Contacts.test.ts index 9d265164c..1e2d28b2c 100644 --- a/packages/js-sdk/test/Contacts.test.ts +++ b/packages/js-sdk/test/Contacts.test.ts @@ -258,7 +258,7 @@ 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) @@ -266,12 +266,17 @@ describe('Contacts', () => { 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, })