Skip to content

Commit

Permalink
Tests running clean
Browse files Browse the repository at this point in the history
  • Loading branch information
brickpop committed Nov 14, 2024
1 parent ed42c4a commit 9a70bc7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
12 changes: 11 additions & 1 deletion test/EmergencyMultisigTree.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1537,6 +1537,9 @@ contract EmergencyMultisigTest is AragonTest {
vm.startPrank(randomWallet);
eMultisig.approve(0);
assertEq(eMultisig.hasApproved(0, bob), true, "Should be true after approval by appointed wallet");
assertEq(eMultisig.hasApproved(0, randomWallet), true, "Should be true after approval");

assertEq(eMultisig.hasApproved(0, address(0x5555)), false, "5555 should not have approved");
}

function test_WhenCallingCanExecuteOrExecuteBeingOpen() external givenTheProposalIsOpen {
Expand Down Expand Up @@ -1664,6 +1667,9 @@ contract EmergencyMultisigTest is AragonTest {
vm.startPrank(randomWallet);
eMultisig.approve(0);
assertEq(eMultisig.hasApproved(0, bob), true, "Should be true for bob after appointed wallet approves");
assertEq(eMultisig.hasApproved(0, randomWallet), true, "Should be true after approval");

assertEq(eMultisig.hasApproved(0, address(0x5555)), false, "5555 should not have approved");
}

function test_WhenCallingCanExecuteOrExecuteBeingApproved() external givenTheProposalWasApprovedByTheAddress {
Expand Down Expand Up @@ -2188,7 +2194,11 @@ contract EmergencyMultisigTest is AragonTest {
assertEq(publicMetadataUriHash, keccak256("ipfs://the-metadata"), "Incorrect publicMetadataUriHash");

// Assert the destination actions hash
assertEq(destinationActionsHash, hex"3626b3f254463d63d9bd5ff77ff99d2691b20f0db6347f685befae593d8f4e6f", "Incorrect destinationActionsHash");
assertEq(
destinationActionsHash,
hex"3626b3f254463d63d9bd5ff77ff99d2691b20f0db6347f685befae593d8f4e6f",
"Incorrect destinationActionsHash"
);

// Assert the destination plugin
assertEq(address(destinationPlugin), address(optimisticPlugin), "Incorrect destinationPlugin");
Expand Down
20 changes: 12 additions & 8 deletions test/MultisigTree.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ contract MultisigTest is AragonTest {
creator: alice,
metadata: "ipfs://",
startDate: uint64(block.timestamp),
endDate: uint64(block.timestamp) + DESTINATION_PROPOSAL_DURATION,
endDate: uint64(block.timestamp) + MULTISIG_PROPOSAL_EXPIRATION_PERIOD,
actions: inputActions,
allowFailureMap: 0
});
Expand Down Expand Up @@ -824,7 +824,7 @@ contract MultisigTest is AragonTest {
creator: bob,
metadata: "ipfs://more",
startDate: uint64(block.timestamp),
endDate: uint64(block.timestamp) + DESTINATION_PROPOSAL_DURATION,
endDate: uint64(block.timestamp) + MULTISIG_PROPOSAL_EXPIRATION_PERIOD,
actions: inputActions,
allowFailureMap: 0
});
Expand Down Expand Up @@ -862,7 +862,7 @@ contract MultisigTest is AragonTest {
creator: carol,
metadata: "ipfs://1234",
startDate: uint64(block.timestamp),
endDate: uint64(block.timestamp) + DESTINATION_PROPOSAL_DURATION,
endDate: uint64(block.timestamp) + MULTISIG_PROPOSAL_EXPIRATION_PERIOD,
actions: inputActions,
allowFailureMap: 0
});
Expand Down Expand Up @@ -1392,8 +1392,9 @@ contract MultisigTest is AragonTest {
assertEq(multisig.canApprove(0, randomWallet), true, "RandomWallet should be able to approve");
vm.startPrank(randomWallet);
vm.expectEmit();
emit Approved(0, randomWallet);
emit Approved(0, bob);
multisig.approve(0, false);
assertEq(multisig.hasApproved(0, bob), true, "RandomWallet's approval should be recorded");
assertEq(multisig.hasApproved(0, randomWallet), true, "RandomWallet's approval should be recorded");

// It canApprove should return false (when unlisted on creation, unappointed now)
Expand Down Expand Up @@ -1528,7 +1529,9 @@ contract MultisigTest is AragonTest {
vm.expectRevert(abi.encodeWithSelector(Multisig.ProposalExecutionForbidden.selector, 0));
multisig.execute(0);

// More approvals
// Approvals
vm.startPrank(alice);
multisig.approve(0, false);
vm.startPrank(randomWallet);
multisig.approve(0, false);

Expand Down Expand Up @@ -1637,6 +1640,7 @@ contract MultisigTest is AragonTest {
// It approve should revert (when unlisted on creation, unappointed now)

// When listed on creation, self appointed now
vm.startPrank(alice);
assertEq(multisig.canApprove(0, alice), false, "Alice should not be able to approve");
vm.expectRevert(abi.encodeWithSelector(Multisig.ApprovalCastForbidden.selector, 0, alice));
multisig.approve(0, false);
Expand Down Expand Up @@ -1846,9 +1850,9 @@ contract MultisigTest is AragonTest {

assertEq(multisig.hasApproved(0, alice), true, "Alice should show as approved");
assertEq(multisig.hasApproved(0, bob), true, "Bob should show as approved");
assertEq(multisig.hasApproved(0, randomWallet), true, "Random wallet should show as approved");
assertEq(multisig.hasApproved(0, carol), true, "Carol should show as approved");
assertEq(multisig.hasApproved(0, david), false, "David should not show as approved");
assertEq(multisig.hasApproved(0, randomWallet), false, "Random wallet should not show as approved");
}

function test_WhenCallingCanExecuteOrExecuteBeingPassed() external givenTheProposalPassed {
Expand Down Expand Up @@ -2091,9 +2095,9 @@ contract MultisigTest is AragonTest {

assertEq(multisig.hasApproved(0, alice), true, "Alice should show as approved");
assertEq(multisig.hasApproved(0, bob), true, "Bob should show as approved");
assertEq(multisig.hasApproved(0, randomWallet), true, "Random wallet should show as approved");
assertEq(multisig.hasApproved(0, carol), true, "Carol should show as approved");
assertEq(multisig.hasApproved(0, david), false, "David should not show as approved");
assertEq(multisig.hasApproved(0, randomWallet), false, "Random wallet should not show as approved");
}

function test_WhenCallingCanExecuteOrExecuteBeingExecuted() external givenTheProposalIsAlreadyExecuted {
Expand Down Expand Up @@ -2247,9 +2251,9 @@ contract MultisigTest is AragonTest {

assertEq(multisig.hasApproved(0, alice), true, "Alice should show as approved");
assertEq(multisig.hasApproved(0, bob), true, "Bob should show as approved");
assertEq(multisig.hasApproved(0, randomWallet), true, "Random wallet should show as approved");
assertEq(multisig.hasApproved(0, carol), false, "Carol should not show as approved");
assertEq(multisig.hasApproved(0, david), false, "David should not show as approved");
assertEq(multisig.hasApproved(0, randomWallet), false, "Random wallet should not show as approved");
}

function test_WhenCallingCanExecuteOrExecuteBeingExpired() external givenTheProposalExpired {
Expand Down

0 comments on commit 9a70bc7

Please sign in to comment.