Skip to content

Commit

Permalink
fix: update to use specified caller, uniform tests
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas-manuel committed Nov 10, 2023
1 parent b8e6669 commit c64a86b
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/SparkLendFreezerMom.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ contract ConstructorTests is SparkLendFreezerMomUnitTestBase {

contract SetOwnerTests is SparkLendFreezerMomUnitTestBase {

function test_setOwner_no_auth() public {
function test_setOwner_noAuth() public {
vm.expectRevert("SparkLendFreezerMom/only-owner");
freezer.setOwner(address(1));
}
Expand All @@ -64,7 +64,7 @@ contract SetOwnerTests is SparkLendFreezerMomUnitTestBase {

contract SetAuthorityTests is SparkLendFreezerMomUnitTestBase {

function test_setAuthority_no_auth() public {
function test_setAuthority_noAuth() public {
vm.expectRevert("SparkLendFreezerMom/only-owner");
freezer.setAuthority(makeAddr("newAuthority"));
}
Expand All @@ -89,8 +89,10 @@ contract FreezeAllMarketsTests is SparkLendFreezerMomUnitTestBase {
}

function test_freezeAllMarkets() public {
address caller = makeAddr("caller");

authority.__setCanCall(
address(this),
caller,
address(freezer),
freezer.freezeAllMarkets.selector,
true
Expand All @@ -105,6 +107,7 @@ contract FreezeAllMarketsTests is SparkLendFreezerMomUnitTestBase {
bytes4 poolSig = PoolMock.getReservesList.selector;
bytes4 configSig = ConfiguratorMock.setReserveFreeze.selector;

vm.prank(caller);
vm.expectCall(pool, abi.encodePacked(poolSig));
vm.expectCall(configurator, abi.encodePacked(configSig, abi.encode(asset1, true)));
vm.expectCall(configurator, abi.encodePacked(configSig, abi.encode(asset2, true)));
Expand All @@ -123,15 +126,18 @@ contract FreezeMarketTests is SparkLendFreezerMomUnitTestBase {
}

function test_freezeMarket() public {
address caller = makeAddr("caller");

authority.__setCanCall(
address(this),
caller,
address(freezer),
freezer.freezeMarket.selector,
true
);

bytes4 configSig = ConfiguratorMock.setReserveFreeze.selector;

vm.prank(caller);
vm.expectCall(configurator, abi.encodePacked(configSig, abi.encode(reserve, true)));
freezer.freezeMarket(reserve);
}
Expand Down

0 comments on commit c64a86b

Please sign in to comment.