Skip to content

Commit

Permalink
Minor additions to the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed May 10, 2024
1 parent d72f85e commit c118413
Showing 1 changed file with 37 additions and 1 deletion.
38 changes: 37 additions & 1 deletion packages/contracts/test/unit-testing/main-voting-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2394,6 +2394,12 @@ describe('Tests replicated from the original AddressList plugin', async () => {
.false;
expect(await mainVotingPlugin.isSupportThresholdReached(id)).to.be.true;
expect(await mainVotingPlugin.canExecute(id)).to.be.false;
await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);

// 2
await mainVotingPlugin
Expand All @@ -2406,13 +2412,25 @@ describe('Tests replicated from the original AddressList plugin', async () => {
.false;
expect(await mainVotingPlugin.isSupportThresholdReached(id)).to.be.true;
expect(await mainVotingPlugin.canExecute(id)).to.be.false;
await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);

await advanceAfterVoteEnd(endDate);

expect(await mainVotingPlugin.isMinParticipationReached(id)).to.be
.false;
expect(await mainVotingPlugin.isSupportThresholdReached(id)).to.be.true;
expect(await mainVotingPlugin.canExecute(id)).to.be.false;
await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);
});

it('does not execute if participation is high enough but support is too low', async () => {
Expand All @@ -2432,13 +2450,24 @@ describe('Tests replicated from the original AddressList plugin', async () => {
expect(await mainVotingPlugin.isSupportThresholdReachedEarly(id)).to.be
.false;
expect(await mainVotingPlugin.canExecute(id)).to.be.false;

await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);
await advanceAfterVoteEnd(endDate);

expect(await mainVotingPlugin.isMinParticipationReached(id)).to.be.true;
expect(await mainVotingPlugin.isSupportThresholdReached(id)).to.be
.false;
expect(await mainVotingPlugin.canExecute(id)).to.be.false;
await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);
});

it('executes after the duration if participation and support thresholds are met', async () => {
Expand Down Expand Up @@ -2497,6 +2526,13 @@ describe('Tests replicated from the original AddressList plugin', async () => {

expect(await mainVotingPlugin.addresslistLength()).to.eq(5);

await expect(mainVotingPlugin.execute(id))
.to.be.revertedWithCustomError(
mainVotingPlugin,
'ProposalExecutionForbidden'
)
.withArgs(id);

// 1
await mainVotingPlugin
.connect(signers[0])
Expand Down

0 comments on commit c118413

Please sign in to comment.