Skip to content

Commit

Permalink
fix naming of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
RensR committed Nov 13, 2024
1 parent 609e9ef commit 1202ea8
Show file tree
Hide file tree
Showing 11 changed files with 42 additions and 53 deletions.
33 changes: 11 additions & 22 deletions contracts/gas-snapshots/shared.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,17 @@ AuthorizedCallers_applyAuthorizedCallerUpdates:test_SkipRemove_Success() (gas: 3
AuthorizedCallers_applyAuthorizedCallerUpdates:test_ZeroAddressNotAllowed_Revert() (gas: 64413)
AuthorizedCallers_constructor:test_ZeroAddressNotAllowed_Revert() (gas: 64390)
AuthorizedCallers_constructor:test_constructor_Success() (gas: 674931)
BurnMintERC20approve:test_approve_InvalidAddress_Reverts() (gas: 11280)
BurnMintERC20approve:test_approve_Success() (gas: 57653)
BurnMintERC20burn:test_BasicBurn_Success() (gas: 153605)
BurnMintERC20burn:test_burn_BurnFromZeroAddress_Reverts() (gas: 43836)
BurnMintERC20burn:test_burn_ExceedsBalance_Reverts() (gas: 21892)
BurnMintERC20burn:test_burn_SenderNotBurner_Reverts() (gas: 68104)
BurnMintERC20burnFrom:test_BurnFrom_Success() (gas: 58012)
BurnMintERC20burnFrom:test_burnFrom_ExceedsBalance_Reverts() (gas: 35864)
BurnMintERC20burnFrom:test_burnFrom_InsufficientAllowance_Reverts() (gas: 21858)
BurnMintERC20burnFrom:test_burnFrom_SenderNotBurner_Reverts() (gas: 68126)
BurnMintERC20burnFromAlias:test_burn_ExceedsBalance_Reverts() (gas: 35905)
BurnMintERC20burnFromAlias:test_burn_InsufficientAllowance_Reverts() (gas: 21889)
BurnMintERC20burnFromAlias:test_burn_SenderNotBurner_Reverts() (gas: 68157)
BurnMintERC20burnFromAlias:test_burn_Success() (gas: 58004)
BurnMintERC20constructor:test_Constructor_Success() (gas: 1694875)
BurnMintERC20getCCIPAdmin:test_getCCIPAdmin_Success() (gas: 10525)
BurnMintERC20getCCIPAdmin:test_setCCIPAdmin_Success() (gas: 21612)
BurnMintERC20grantMintAndBurnRoles:test_GrantMintAndBurnRoles_Success() (gas: 79120)
BurnMintERC20mint:test_mint() (gas: 101849)
BurnMintERC20supportsInterface:test_SupportsInterface_Success() (gas: 11217)
BurnMintERC20transfer:test_transfer_InvalidAddress_Reverts() (gas: 11301)
BurnMintERC20transfer:test_transfer_Success() (gas: 42316)
BurnMintERC20_approve:test_approve() (gas: 57652)
BurnMintERC20_burn:test_BasicBurn() (gas: 153607)
BurnMintERC20_burnFrom:test_BurnFrom() (gas: 57995)
BurnMintERC20_burnFromAlias:test_burn() (gas: 58039)
BurnMintERC20_constructor:test_Constructor() (gas: 1694831)
BurnMintERC20_getCCIPAdmin:test_getCCIPAdmin() (gas: 10548)
BurnMintERC20_getCCIPAdmin:test_setCCIPAdmin() (gas: 21590)
BurnMintERC20_grantMintAndBurnRoles:test_GrantMintAndBurnRoles() (gas: 79142)
BurnMintERC20_mint:test_mint() (gas: 101849)
BurnMintERC20_supportsInterface:test_SupportsInterface() (gas: 11218)
BurnMintERC20_transfer:test_transfer() (gas: 42338)
BurnMintERC677_approve:testApproveSuccess() (gas: 55512)
BurnMintERC677_approve:testInvalidAddressReverts() (gas: 10663)
BurnMintERC677_burn:testBasicBurnSuccess() (gas: 172100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity 0.8.24;
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol";

contract BurnMintERC20approve is BurnMintERC20Setup {
function test_approve_Success() public {
contract BurnMintERC20_approve is BurnMintERC20Setup {
function test_approve() public {
uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER);
uint256 sendingAmount = s_amount / 2;

Expand All @@ -23,7 +23,7 @@ contract BurnMintERC20approve is BurnMintERC20Setup {

// Reverts

function test_approve_InvalidAddress_Reverts() public {
function test_approve_RevertWhen_InvalidAddress() public {
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20)));

s_burnMintERC20.approve(address(s_burnMintERC20), s_amount);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol";

contract BurnMintERC20burn is BurnMintERC20Setup {
function test_BasicBurn_Success() public {
contract BurnMintERC20_burn is BurnMintERC20Setup {
function test_BasicBurn() public {
s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), OWNER);
deal(address(s_burnMintERC20), OWNER, s_amount);

Expand All @@ -22,7 +22,7 @@ contract BurnMintERC20burn is BurnMintERC20Setup {

// Revert

function test_burn_SenderNotBurner_Reverts() public {
function test_burn_RevertWhen_SenderNotBurner() public {
// OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful
// and should be checked
vm.expectRevert(
Expand All @@ -37,15 +37,15 @@ contract BurnMintERC20burn is BurnMintERC20Setup {
s_burnMintERC20.burnFrom(STRANGER, s_amount);
}

function test_burn_ExceedsBalance_Reverts() public {
function test_burn_RevertWhen_ExceedsBalance() public {
changePrank(s_mockPool);

vm.expectRevert("ERC20: burn amount exceeds balance");

s_burnMintERC20.burn(s_amount * 2);
}

function test_burn_BurnFromZeroAddress_Reverts() public {
function test_burn_RevertWhen_BurnFromZeroAddress() public {
s_burnMintERC20.grantRole(s_burnMintERC20.BURNER_ROLE(), address(0));
changePrank(address(0));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";

import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol";

contract BurnMintERC20burnFrom is BurnMintERC20Setup {
contract BurnMintERC20_burnFrom is BurnMintERC20Setup {
function setUp() public virtual override {
BurnMintERC20Setup.setUp();
}

function test_BurnFrom_Success() public {
function test_BurnFrom() public {
s_burnMintERC20.approve(s_mockPool, s_amount);

changePrank(s_mockPool);
Expand All @@ -23,7 +23,7 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup {

// Reverts

function test_burnFrom_SenderNotBurner_Reverts() public {
function test_burnFrom_RevertWhen_SenderNotBurner() public {
// OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful
// and should be checked
vm.expectRevert(
Expand All @@ -38,15 +38,15 @@ contract BurnMintERC20burnFrom is BurnMintERC20Setup {
s_burnMintERC20.burnFrom(OWNER, s_amount);
}

function test_burnFrom_InsufficientAllowance_Reverts() public {
function test_burnFrom_RevertWhen_InsufficientAllowance() public {
changePrank(s_mockPool);

vm.expectRevert("ERC20: insufficient allowance");

s_burnMintERC20.burnFrom(OWNER, s_amount);
}

function test_burnFrom_ExceedsBalance_Reverts() public {
function test_burnFrom_RevertWhen_ExceedsBalance() public {
s_burnMintERC20.approve(s_mockPool, s_amount * 2);

changePrank(s_mockPool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";

import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol";

contract BurnMintERC20burnFromAlias is BurnMintERC20Setup {
contract BurnMintERC20_burnFromAlias is BurnMintERC20Setup {
function setUp() public virtual override {
BurnMintERC20Setup.setUp();
}

function test_burn_Success() public {
function test_burn() public {
s_burnMintERC20.approve(s_mockPool, s_amount);

changePrank(s_mockPool);
Expand All @@ -23,7 +23,7 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup {

// Reverts

function test_burn_SenderNotBurner_Reverts() public {
function test_burn_RevertWhen_SenderNotBurner() public {
// OZ Access Control v4.8.3 inherited by BurnMintERC20 does not use custom errors, but the revert message is still useful
// and should be checked
vm.expectRevert(
Expand All @@ -38,15 +38,15 @@ contract BurnMintERC20burnFromAlias is BurnMintERC20Setup {
s_burnMintERC20.burn(OWNER, s_amount);
}

function test_burn_InsufficientAllowance_Reverts() public {
function test_burn_RevertWhen_InsufficientAllowance() public {
changePrank(s_mockPool);

vm.expectRevert("ERC20: insufficient allowance");

s_burnMintERC20.burn(OWNER, s_amount);
}

function test_burn_ExceedsBalance_Reverts() public {
function test_burn_RevertWhen_ExceedsBalance() public {
s_burnMintERC20.approve(s_mockPool, s_amount * 2);

changePrank(s_mockPool);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ pragma solidity 0.8.24;
import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol";
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";

contract BurnMintERC20getCCIPAdmin is BurnMintERC20Setup {
function test_getCCIPAdmin_Success() public view {
contract BurnMintERC20_getCCIPAdmin is BurnMintERC20Setup {
function test_getCCIPAdmin() public view {
assertEq(OWNER, s_burnMintERC20.getCCIPAdmin());
}

function test_setCCIPAdmin_Success() public {
function test_setCCIPAdmin() public {
address newAdmin = makeAddr("newAdmin");

vm.expectEmit();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity 0.8.24;
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol";

contract BurnMintERC20constructor is BurnMintERC20Setup {
function test_Constructor_Success() public {
contract BurnMintERC20_constructor is BurnMintERC20Setup {
function test_Constructor() public {
vm.startPrank(s_alice);

string memory name = "Chainlink token v2";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";

import {IAccessControl} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/access/IAccessControl.sol";

contract BurnMintERC20grantMintAndBurnRoles is BurnMintERC20Setup {
function test_GrantMintAndBurnRoles_Success() public {
contract BurnMintERC20_grantMintAndBurnRoles is BurnMintERC20Setup {
function test_GrantMintAndBurnRoles() public {
assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.MINTER_ROLE(), STRANGER));
assertFalse(s_burnMintERC20.hasRole(s_burnMintERC20.BURNER_ROLE(), STRANGER));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {Strings} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/Strings.sol";

contract BurnMintERC20mint is BurnMintERC20Setup {
contract BurnMintERC20_mint is BurnMintERC20Setup {
function test_mint() public {
uint256 balancePre = s_burnMintERC20.balanceOf(OWNER);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {IERC20} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/token/ERC20/IERC20.sol";
import {IERC165} from "../../../../../vendor/openzeppelin-solidity/v4.8.3/contracts/utils/introspection/IERC165.sol";

contract BurnMintERC20supportsInterface is BurnMintERC20Setup {
function test_SupportsInterface_Success() public view {
contract BurnMintERC20_supportsInterface is BurnMintERC20Setup {
function test_SupportsInterface() public view {
assertTrue(s_burnMintERC20.supportsInterface(type(IERC20).interfaceId));
assertTrue(s_burnMintERC20.supportsInterface(type(IBurnMintERC20).interfaceId));
assertTrue(s_burnMintERC20.supportsInterface(type(IERC165).interfaceId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ pragma solidity 0.8.24;
import {BurnMintERC20Setup} from "./BurnMintERC20Setup.t.sol";
import {BurnMintERC20} from "../../../../token/ERC20/BurnMintERC20.sol";

contract BurnMintERC20transfer is BurnMintERC20Setup {
function test_transfer_Success() public {
contract BurnMintERC20_transfer is BurnMintERC20Setup {
function test_transfer() public {
uint256 balancePre = s_burnMintERC20.balanceOf(STRANGER);
uint256 sendingAmount = s_amount / 2;

Expand All @@ -16,7 +16,7 @@ contract BurnMintERC20transfer is BurnMintERC20Setup {

// Reverts

function test_transfer_InvalidAddress_Reverts() public {
function test_transfer_RevertWhen_InvalidAddress() public {
vm.expectRevert(abi.encodeWithSelector(BurnMintERC20.InvalidRecipient.selector, address(s_burnMintERC20)));

s_burnMintERC20.transfer(address(s_burnMintERC20), s_amount);
Expand Down

0 comments on commit 1202ea8

Please sign in to comment.