From ff93c78c23bd052d3fdbe830952a0e4c688fbac4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20sayous?= Date: Tue, 20 Sep 2022 10:49:01 +0200 Subject: [PATCH] fix: early user tests (#26) --- test/e2e/e2e.test.ts | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/test/e2e/e2e.test.ts b/test/e2e/e2e.test.ts index 6ef4d2b..dca6721 100644 --- a/test/e2e/e2e.test.ts +++ b/test/e2e/e2e.test.ts @@ -254,9 +254,12 @@ describe('Test E2E Protocol', () => { [proofRequest1, proofRequest2] ); const { events } = await tx.wait(); - const args = getEventArgs(events, 'EarlyUserAttestationGenerated'); - expect(args.destination).to.eql(request1.destination); + const earlyUserActivated = Date.now() < Date.parse('15 Sept 2022 00:00:00 GMT'); + if (earlyUserActivated) { + const args = getEventArgs(events, 'EarlyUserAttestationGenerated'); + expect(args.destination).to.eql(request1.destination); + } const attestationsValues = await attestationsRegistry.getAttestationValueBatch( [ @@ -270,7 +273,7 @@ describe('Test E2E Protocol', () => { const expectedAttestationsValues = [ attestationsRequested1[0].value, attestationsRequested2[0].value, - BigNumber.from(1), + earlyUserActivated ? BigNumber.from(1) : BigNumber.from(0), ]; expect(attestationsValues).to.be.eql(expectedAttestationsValues); @@ -325,9 +328,11 @@ describe('Test E2E Protocol', () => { ); await front.generateAttestations(hydraS1SoulboundAttester.address, request2, proofRequest2); const { events } = await tx.wait(); - const args = getEventArgs(events, 'EarlyUserAttestationGenerated'); - - expect(args.destination).to.eql(request1.destination); + const earlyUserActivated = Date.now() < Date.parse('15 Sept 2022 00:00:00 GMT'); + if (earlyUserActivated) { + const args = getEventArgs(events, 'EarlyUserAttestationGenerated'); + expect(args.destination).to.eql(request1.destination); + } const attestationsValues = await attestationsRegistry.getAttestationValueBatch( [ @@ -341,7 +346,7 @@ describe('Test E2E Protocol', () => { const expectedAttestationsValues = [ attestationsRequested1[0].value, attestationsRequested2[0].value, - BigNumber.from(1), + earlyUserActivated ? BigNumber.from(1) : BigNumber.from(0), ]; expect(attestationsValues).to.be.eql(expectedAttestationsValues);