Skip to content

Commit

Permalink
♻️ Cleanup tests
Browse files Browse the repository at this point in the history
  • Loading branch information
transmissions11 committed Nov 10, 2021
1 parent 3ce535e commit 3e2958f
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
7 changes: 4 additions & 3 deletions src/test/Vault.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ contract VaultsTest is DSTestPlus {

function setUp() public {
underlying = new MockERC20("Mock Token", "TKN", 18);

vault = new VaultFactory().deployVault(underlying);

vault.setFeePercent(0.1e18);
Expand All @@ -35,7 +36,7 @@ contract VaultsTest is DSTestPlus {
}

/*///////////////////////////////////////////////////////////////
BASIC DEPOSIT/WITHDRAWAL TESTS
DEPOSIT/WITHDRAWAL TESTS
//////////////////////////////////////////////////////////////*/

function testAtomicDepositWithdraw() public {
Expand Down Expand Up @@ -146,7 +147,7 @@ contract VaultsTest is DSTestPlus {
}

/*///////////////////////////////////////////////////////////////
BASIC STRATEGY DEPOSIT/WITHDRAWAL TESTS
STRATEGY DEPOSIT/WITHDRAWAL TESTS
//////////////////////////////////////////////////////////////*/

function testAtomicEnterExitSinglePool() public {
Expand Down Expand Up @@ -294,7 +295,7 @@ contract VaultsTest is DSTestPlus {
}

/*///////////////////////////////////////////////////////////////
BASIC HARVEST TESTS
HARVEST TESTS
//////////////////////////////////////////////////////////////*/

function testProfitableHarvest() public {
Expand Down
3 changes: 2 additions & 1 deletion src/test/VaultFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ contract VaultFactoryTest is DSTestPlus {
MockERC20 underlying;

function setUp() public {
vaultFactory = new VaultFactory();
underlying = new MockERC20("Mock Token", "TKN", 18);

vaultFactory = new VaultFactory();
}

function testDeployVault() public {
Expand Down
6 changes: 3 additions & 3 deletions src/test/mocks/MockETHStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ contract MockETHStrategy is ERC20("Mock cEther Strategy", "cEther", 18), ETHStra
using FixedPointMathLib for uint256;

/*///////////////////////////////////////////////////////////////
STRATEGY FUNCTIONS
STRATEGY LOGIC
//////////////////////////////////////////////////////////////*/

function isCEther() external pure override returns (bool) {
Expand All @@ -36,7 +36,7 @@ contract MockETHStrategy is ERC20("Mock cEther Strategy", "cEther", 18), ETHStra
}

/*///////////////////////////////////////////////////////////////
INTERNAL LOGIC
INTERNAL LOGIC
//////////////////////////////////////////////////////////////*/

function exchangeRate() internal view returns (uint256) {
Expand All @@ -48,7 +48,7 @@ contract MockETHStrategy is ERC20("Mock cEther Strategy", "cEther", 18), ETHStra
}

/*///////////////////////////////////////////////////////////////
MOCK FUNCTIONS
MOCK LOGIC
//////////////////////////////////////////////////////////////*/

function simulateLoss(uint256 underlyingAmount) external {
Expand Down
12 changes: 6 additions & 6 deletions src/test/mocks/MockStrategy.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ contract MockStrategy is ERC20("Mock cToken Strategy", "cMOCK", 18), ERC20Strate
using SafeTransferLib for ERC20;
using FixedPointMathLib for uint256;

/*///////////////////////////////////////////////////////////////
STRATEGY FUNCTIONS
//////////////////////////////////////////////////////////////*/

constructor(ERC20 _UNDERLYING) {
UNDERLYING = _UNDERLYING;

BASE_UNIT = 10**_UNDERLYING.decimals();
}

/*///////////////////////////////////////////////////////////////
STRATEGY LOGIC
//////////////////////////////////////////////////////////////*/

function isCEther() external pure override returns (bool) {
return false;
}
Expand Down Expand Up @@ -50,7 +50,7 @@ contract MockStrategy is ERC20("Mock cToken Strategy", "cMOCK", 18), ERC20Strate
}

/*///////////////////////////////////////////////////////////////
INTERNAL LOGIC
INTERNAL LOGIC
//////////////////////////////////////////////////////////////*/

ERC20 internal immutable UNDERLYING;
Expand All @@ -66,7 +66,7 @@ contract MockStrategy is ERC20("Mock cToken Strategy", "cMOCK", 18), ERC20Strate
}

/*///////////////////////////////////////////////////////////////
MOCK FUNCTIONS
MOCK LOGIC
//////////////////////////////////////////////////////////////*/

function simulateLoss(uint256 underlyingAmount) external {
Expand Down

0 comments on commit 3e2958f

Please sign in to comment.