From f0d0acd1fe5a5edca0807d0c223bb2c8319a631c Mon Sep 17 00:00:00 2001 From: Adam Gall Date: Wed, 6 Nov 2024 12:16:10 -0500 Subject: [PATCH] Add more tests to confirm non-owner cannot remove hat from whitelist --- ...rius-LinearERC20VotingWithHatsProposalCreation.test.ts | 8 ++++++++ ...ius-LinearERC721VotingWithHatsProposalCreation.test.ts | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/test/Azorius-LinearERC20VotingWithHatsProposalCreation.test.ts b/test/Azorius-LinearERC20VotingWithHatsProposalCreation.test.ts index b744980..7b16b60 100644 --- a/test/Azorius-LinearERC20VotingWithHatsProposalCreation.test.ts +++ b/test/Azorius-LinearERC20VotingWithHatsProposalCreation.test.ts @@ -255,6 +255,14 @@ describe('LinearERC20VotingWithHatsProposalCreation', () => { ); }); + it('Non-owner cannot remove a hat from the whitelist', async () => { + const hatId = 1; // Example hat ID + + await expect( + linearERC20VotingWithHats.connect(rando).removeHatFromWhitelist(hatId), + ).to.be.revertedWith('Ownable: caller is not the owner'); + }); + it('Cannot call setUp function again', async () => { const setupParams = ethers.AbiCoder.defaultAbiCoder().encode( ['address', 'address', 'address', 'uint32', 'uint256', 'uint256', 'address', 'uint256[]'], diff --git a/test/Azorius-LinearERC721VotingWithHatsProposalCreation.test.ts b/test/Azorius-LinearERC721VotingWithHatsProposalCreation.test.ts index 38fea2c..dec15eb 100644 --- a/test/Azorius-LinearERC721VotingWithHatsProposalCreation.test.ts +++ b/test/Azorius-LinearERC721VotingWithHatsProposalCreation.test.ts @@ -237,6 +237,14 @@ describe('LinearERC721VotingWithHatsProposalCreation', () => { ); }); + it('Non-owner cannot remove a hat from the whitelist', async () => { + const hatId = 1; // Example hat ID + + await expect( + linearERC721VotingWithHats.connect(rando).removeHatFromWhitelist(hatId), + ).to.be.revertedWith('Ownable: caller is not the owner'); + }); + it('Cannot call setUp function again', async () => { const setupParams = ethers.AbiCoder.defaultAbiCoder().encode( [