Skip to content

Commit

Permalink
Add tests on cancelAllPendingProposals return value
Browse files Browse the repository at this point in the history
  • Loading branch information
Psirex committed Sep 25, 2024
1 parent c41e546 commit 0c8f50e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
15 changes: 10 additions & 5 deletions test/unit/DualGovernance.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ contract DualGovernanceUnitTests is UnitTest {
vm.expectEmit();
emit DualGovernance.CancelAllPendingProposalsSkipped();

_dualGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _dualGovernance.cancelAllPendingProposals();

assertFalse(isProposalsCancelled);
assertEq(_timelock.getProposalsCount(), 1);
assertEq(_timelock.lastCancelledProposalId(), 0);
}
Expand Down Expand Up @@ -286,8 +287,9 @@ contract DualGovernanceUnitTests is UnitTest {
vm.expectEmit();
emit DualGovernance.CancelAllPendingProposalsSkipped();

_dualGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _dualGovernance.cancelAllPendingProposals();

assertFalse(isProposalsCancelled);
assertEq(_timelock.getProposalsCount(), 1);
assertEq(_timelock.lastCancelledProposalId(), 0);
}
Expand All @@ -312,8 +314,9 @@ contract DualGovernanceUnitTests is UnitTest {
vm.expectEmit();
emit DualGovernance.CancelAllPendingProposalsSkipped();

_dualGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _dualGovernance.cancelAllPendingProposals();

assertFalse(isProposalsCancelled);
assertEq(_timelock.getProposalsCount(), 1);
assertEq(_timelock.lastCancelledProposalId(), 0);
}
Expand All @@ -333,8 +336,9 @@ contract DualGovernanceUnitTests is UnitTest {
vm.expectEmit();
emit DualGovernance.CancelAllPendingProposalsExecuted();

_dualGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _dualGovernance.cancelAllPendingProposals();

assertTrue(isProposalsCancelled);
assertEq(_timelock.getProposalsCount(), 1);
assertEq(_timelock.lastCancelledProposalId(), 1);
}
Expand All @@ -361,8 +365,9 @@ contract DualGovernanceUnitTests is UnitTest {
vm.expectEmit();
emit DualGovernance.CancelAllPendingProposalsExecuted();

_dualGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _dualGovernance.cancelAllPendingProposals();

assertTrue(isProposalsCancelled);
assertEq(_timelock.getProposalsCount(), 1);
assertEq(_timelock.lastCancelledProposalId(), 1);
}
Expand Down
3 changes: 2 additions & 1 deletion test/unit/TimelockedGovernance.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,9 @@ contract TimelockedGovernanceUnitTests is UnitTest {
_timelock.setSchedule(1);
_timelockedGovernance.scheduleProposal(1);

_timelockedGovernance.cancelAllPendingProposals();
bool isProposalsCancelled = _timelockedGovernance.cancelAllPendingProposals();

assertTrue(isProposalsCancelled);
assertEq(_timelock.getLastCancelledProposalId(), 2);
}

Expand Down

0 comments on commit 0c8f50e

Please sign in to comment.