Skip to content

Commit

Permalink
fix tests where assumptions weren't set totally right. No changes to …
Browse files Browse the repository at this point in the history
…actual code
  • Loading branch information
mpeyfuss committed Jul 31, 2024
1 parent 5a63267 commit 8c76440
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions test/access/OwnableAccessControl.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ contract TestOwnableAccessControl is Test {
}

function test_AdminRole(address admin, address minter, uint256 newNumberOne, uint256 newNumberTwo) public {
vm.assume(admin != address(this));

mockContract = new MockOwnableAccessControl();
address[] memory admins = new address[](1);
admins[0] = admin;
Expand Down Expand Up @@ -161,6 +163,8 @@ contract TestOwnableAccessControl is Test {
}

function test_MinterRole(address minter, uint256 newNumber) public {
vm.assume(minter != address(this));

mockContract = new MockOwnableAccessControl();
// grant minter role and expect proper event log
address[] memory minters = new address[](1);
Expand Down
5 changes: 4 additions & 1 deletion test/payments/TransferHelper.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ contract TestTransferHelper is Test {
}

function test_SafeTransferFromERC20(address recipient, uint256 amount) public {
vm.assume(recipient != address(0) && recipient != address(th) && amount > 0);
vm.assume(recipient != address(0));
vm.assume(recipient != address(th));
vm.assume(recipient != chris);
vm.assume(amount > 0);

// fund chris
vm.prank(ben);
Expand Down
4 changes: 4 additions & 0 deletions test/upgradeable/access/OwnableAccessControlUpgradeable.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ contract OwnableAccessControlTest is Test {
}

function test_AdminRole(address admin, address minter, uint256 newNumberOne, uint256 newNumberTwo) public {
vm.assume(admin != address(this));

mockContract = new MockOwnableAccessControlUpgradeable();
mockContract.initialize(address(this));
address[] memory admins = new address[](1);
Expand Down Expand Up @@ -187,6 +189,8 @@ contract OwnableAccessControlTest is Test {
}

function test_MinterRole(address minter, uint256 newNumber) public {
vm.assume(minter != address(this));

mockContract = new MockOwnableAccessControlUpgradeable();
mockContract.initialize(address(this));
// grant minter role and expect proper event log
Expand Down

0 comments on commit 8c76440

Please sign in to comment.