Skip to content

Commit

Permalink
Adds pledgerCount tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesduncombe committed Feb 19, 2024
1 parent aa41d1f commit 02770d2
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/fast/Crowdfund.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit 02770d2

Please sign in to comment.