Skip to content

Commit

Permalink
test: removeStrategy()
Browse files Browse the repository at this point in the history
  • Loading branch information
haythemsellami committed May 7, 2024
1 parent 29dcec2 commit 7f57dad
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions test/unit/RemoveStrategy.t.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;

import {FourSixTwoSixAggBase, FourSixTwoSixAgg} from "./FourSixTwoSixAggBase.t.sol";

contract RemoveStrategyTest is FourSixTwoSixAggBase {
uint256 strategyAllocationPoints;

function setUp() public virtual override {
super.setUp();

strategyAllocationPoints = type(uint120).max;
_addStrategy(manager, address(eTST), strategyAllocationPoints);
}

function testRemoveStrategy() public {
uint256 totalAllocationPointsBefore = fourSixTwoSixAgg.totalAllocationPoints();
uint256 withdrawalQueueLengthBefore = fourSixTwoSixAgg.withdrawalQueueLength();

vm.prank(manager);
fourSixTwoSixAgg.removeStrategy(address(eTST));

FourSixTwoSixAgg.Strategy memory strategyAfter = fourSixTwoSixAgg.getStrategy(address(eTST));

assertEq(strategyAfter.active, false);
assertEq(strategyAfter.allocationPoints, 0);
assertEq(fourSixTwoSixAgg.totalAllocationPoints(), totalAllocationPointsBefore - strategyAllocationPoints);
assertEq(fourSixTwoSixAgg.withdrawalQueueLength(), withdrawalQueueLengthBefore - 1);
}

function testRemoveStrategy_fromUnauthorized() public {
vm.prank(deployer);
vm.expectRevert();
fourSixTwoSixAgg.removeStrategy(address(eTST));
}

function testRemoveStrategy_AlreadyRemoved() public {
vm.prank(manager);
vm.expectRevert();
fourSixTwoSixAgg.removeStrategy(address(eTST2));
}
}

0 comments on commit 7f57dad

Please sign in to comment.