Skip to content

Commit

Permalink
Cleanup test
Browse files Browse the repository at this point in the history
  • Loading branch information
stevieraykatz committed Mar 27, 2024
1 parent ce5b9bf commit 7525139
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/MultiOwnable/RemoveOwnerAtIndex.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,29 @@ import "./MultiOwnableTestBase.t.sol";
contract RemoveOwnerAtIndexTest is MultiOwnableTestBase {
function testRemovesOwner() public {
vm.prank(owner1Address);
_removeOwner(owner2Bytes);
mock.removeOwnerAtIndex(_index(), owner2Bytes);
assertFalse(mock.isOwnerBytes(owner2Bytes));
}

function testRemovesOwnerAtIndex() public {
uint8 index = _index();
vm.prank(owner1Address);
_removeOwner(owner2Bytes);
mock.removeOwnerAtIndex(index, owner2Bytes);
assertEq(mock.ownerAtIndex(index), hex"");
}

function testEmitsRemoveOwner() public {
vm.expectEmit(true, true, true, true);
emit MultiOwnable.RemoveOwner(_index(), owner2Bytes);
vm.prank(owner1Address);
_removeOwner(owner2Bytes);
mock.removeOwnerAtIndex(_index(), owner2Bytes);
}

function testRevertsIfCalledByNonOwner(address a) public {
vm.assume(a != owner1Address);
vm.startPrank(a);
vm.expectRevert(MultiOwnable.Unauthorized.selector);
_removeOwner(abi.encode(a));
mock.removeOwnerAtIndex(_index(), abi.encode(a));
}

function testRevertsIfNoOwnerAtIndex() public {
Expand All @@ -45,10 +45,6 @@ contract RemoveOwnerAtIndexTest is MultiOwnableTestBase {
mock.removeOwnerAtIndex(index, owner1Bytes);
}

function _removeOwner(bytes memory owner) internal virtual {
mock.removeOwnerAtIndex(_index(), owner);
}

function _index() internal virtual returns (uint8) {
return 1;
}
Expand Down

0 comments on commit 7525139

Please sign in to comment.