Skip to content

Commit

Permalink
Added more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
martinvol committed Oct 5, 2024
1 parent 5176478 commit 9015245
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion packages/protocol/test-sol/unit/common/FeeHandler.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -813,11 +813,29 @@ contract FeeHandlerTest_Transfer is FeeHandlerTest {
}

contract FeeHandlerTest_SetDailySellLimit is FeeHandlerTest {
uint256 newCeloAmountForRate;

function setUp() public {
super.setUp();
newCeloAmountForRate = celoAmountForRate * 2;
}

function test_Reverts_WhenCallerNotOwner() public {
vm.expectRevert("Ownable: caller is not the owner");
vm.prank(user);
feeHandler.setDailySellLimit(address(stableToken), celoAmountForRate);
}

function test_SetsDailySellLimit() public {
feeHandler.setDailySellLimit(address(stableToken), newCeloAmountForRate);
assertEq(feeHandler.getTokenDailySellLimit(address(stableToken)), newCeloAmountForRate);
}

function test_Emits_DailyLimitSet() public {
vm.expectEmit(true, true, true, true);
emit DailyLimitSet(address(stableToken), newCeloAmountForRate);
feeHandler.setDailySellLimit(address(stableToken), newCeloAmountForRate);
}
}

contract FeeHandlerTest_SetMaxSlippage is FeeHandlerTest {
Expand All @@ -839,7 +857,7 @@ contract FeeHandlerTest_SetMaxSlippage is FeeHandlerTest {
assertEq(feeHandler.getTokenMaxSlippage(address(stableToken)), newMaxSlipapge);
}

function test_SetsMaxSlippageAndEmitsEvent() public {
function test_Emits_MaxSlippageSet() public {
vm.expectEmit(true, true, true, true);
emit MaxSlippageSet(address(stableToken), maxSlippage);
feeHandler.setMaxSplippage(address(stableToken), maxSlippage);
Expand Down

0 comments on commit 9015245

Please sign in to comment.