From 02770d2889dc498d19111abfe22ea668bb19c49b Mon Sep 17 00:00:00 2001 From: James Duncombe Date: Mon, 19 Feb 2024 17:27:53 +0000 Subject: [PATCH] Adds pledgerCount tests. --- test/fast/Crowdfund.test.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/test/fast/Crowdfund.test.ts b/test/fast/Crowdfund.test.ts index afc6b107..e0e5470b 100644 --- a/test/fast/Crowdfund.test.ts +++ b/test/fast/Crowdfund.test.ts @@ -244,6 +244,27 @@ describe("Crowdfunds", () => { }); }); + describe("pledgerCount", () => { + beforeEach(async () => { + await deployCrowdfund(validParams); + // Provision ERC20 token for bob and alice. + for (const user of [alice, bob]) { + erc20.allowance.returns(1_000_000_000); + erc20.transferFrom.returns(true); + } + }); + + it("returns the number of pledgers", async () => { + await crowdfundAsIssuer.advanceToFunding(20_00); + // Pledge 1000 tokens from bob and alice. + await Promise.all( + [alice, bob].map((user) => crowdfund.connect(user).pledge(500)) + ); + const subject = await crowdfund.pledgerCount(); + expect(subject).to.eq(2); + }); + }); + describe("advanceToFunding", () => { describe("from an invalid phase", () => { it("reverts", async () => {