From bb8a0faf8b5467de725e20b4ba169efe98a0b2aa Mon Sep 17 00:00:00 2001 From: neokry Date: Wed, 13 Dec 2023 13:29:25 -0800 Subject: [PATCH] Add more tests --- test/Gov.t.sol | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/test/Gov.t.sol b/test/Gov.t.sol index cff994e..04b1f83 100644 --- a/test/Gov.t.sol +++ b/test/Gov.t.sol @@ -1161,8 +1161,31 @@ contract GovTest is NounsBuilderTest, GovernorTypesV1 { mock1155.mintBatch(address(governor), _tokenIds, _amounts); } - function testFail_GovernorCannotSetDelayPastMax() public { - deployMockWithDelay(block.timestamp + 31 days); + function testRevert_GovernorOnlyTokenOwnerCanSetDelay() public { + deployMock(); + + vm.prank(voter1); + vm.expectRevert(abi.encodeWithSignature("ONLY_TOKEN_OWNER()")); + governor.updateDelayedGovernanceExpirationTimestamp(1 days); + } + + function testRevert_GovernorCannotSetDelayPastMax() public { + deployMock(); + + vm.prank(founder); + vm.expectRevert(abi.encodeWithSignature("INVALID_DELAYED_GOVERNANCE_EXPIRATION()")); + governor.updateDelayedGovernanceExpirationTimestamp(31 days); + } + + function testRevert_GovernorCannotSetDelayAfterTokensAreMinted() public { + deployMock(); + + vm.prank(founder); + auction.unpause(); + + vm.prank(address(treasury)); + vm.expectRevert(abi.encodeWithSignature("CANNOT_DELAY_GOVERNANCE()")); + governor.updateDelayedGovernanceExpirationTimestamp(1 days); } function testRevert_GovernorCannotProposeInDelayPeriod() public {