Skip to content

Commit

Permalink
Add setDAOAddress test
Browse files Browse the repository at this point in the history
  • Loading branch information
Phanco committed Jan 11, 2024
1 parent 931c71d commit d440301
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions test/L2/L2Claim.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,26 @@ contract L2ClaimTest is Test {
);
}

function test_SetDAOAddress_RevertWhenNotCalledByOwner() public {
address nobody = vm.addr(1);

vm.prank(nobody);
vm.expectRevert(abi.encodeWithSelector(OwnableUpgradeable.OwnableUnauthorizedAccount.selector, nobody));
l2Claim.setDAOAddress(daoAddress);
}

function test_SetDAOAddress_RevertWhenDAOAddressAlreadyBeenSet() public {
l2Claim.setDAOAddress(daoAddress);

vm.expectRevert("L2Claim: DAO Address has already been set");
l2Claim.setDAOAddress(daoAddress);
}

function test_SetDAOAddress_SuccessSet() public {
l2Claim.setDAOAddress(daoAddress);
assertEq(l2Claim.daoAddress(), daoAddress);
}

function test_RecoverLSK_RevertWhenRecoverPeriodNotReached() public {
l2Claim.setDAOAddress(daoAddress);
vm.expectRevert("L2Claim: Recover period not reached");
Expand Down

0 comments on commit d440301

Please sign in to comment.