From d44030180b8c7825e20c701a7f05d70eef23a1b7 Mon Sep 17 00:00:00 2001 From: Franco NG Date: Thu, 11 Jan 2024 14:13:43 +0100 Subject: [PATCH] Add setDAOAddress test --- test/L2/L2Claim.t.sol | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/L2/L2Claim.t.sol b/test/L2/L2Claim.t.sol index 569d098b..e16dabdd 100644 --- a/test/L2/L2Claim.t.sol +++ b/test/L2/L2Claim.t.sol @@ -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");