From 1e5b8aa86d20c411a16563bf22e23213f7f5e032 Mon Sep 17 00:00:00 2001 From: weboko Date: Tue, 24 Jan 2023 00:20:29 +0100 Subject: [PATCH] fix mock approach --- src/rln_contract.spec.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/rln_contract.spec.ts b/src/rln_contract.spec.ts index 04ddd51..f2d11d6 100644 --- a/src/rln_contract.spec.ts +++ b/src/rln_contract.spec.ts @@ -18,9 +18,10 @@ describe("RLN Contract abstraction", () => { provider: voidSigner, }); - chai.spy.on(rlnContract, "contract.queryFilter", () => - Promise.resolve([mockEvent()]) - ); + rlnContract["_contract" as any] = { + queryFilter: () => Promise.resolve([mockEvent()]), + }; + chai.spy.on(rlnContract, "contract.queryFilter"); await rlnContract.fetchMembers(rlnInstance); @@ -38,9 +39,10 @@ describe("RLN Contract abstraction", () => { provider: voidSigner, }); - chai.spy.on(rlnContract, "contract.MEMBERSHIP_DEPOSIT", () => - Promise.resolve(1) - ); + rlnContract["_contract"] = { + MEMBERSHIP_DEPOSIT: () => Promise.resolve(1), + }; + chai.spy.on(rlnContract, "contract.MEMBERSHIP_DEPOSIT"); const contractSpy = chai.spy.on(rlnContract, "contract.register");