From 50155864a2b9f91f3e2e2193c185f95d45bb94b4 Mon Sep 17 00:00:00 2001 From: Schlag <89420541+Schlagonia@users.noreply.github.com> Date: Fri, 8 Dec 2023 09:04:28 -0700 Subject: [PATCH] test: specific tests (#25) * test: specific tests * fix: add solc to toml --- foundry.toml | 1 + src/test/Operation.t.sol | 12 +++++++++--- src/test/Shutdown.t.sol | 8 ++++++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/foundry.toml b/foundry.toml index f93a49cb..f3e432f9 100644 --- a/foundry.toml +++ b/foundry.toml @@ -2,6 +2,7 @@ src = 'src' out = 'out' libs = ['lib'] +solc = "0.8.18" remappings = [ "@openzeppelin/=lib/openzeppelin-contracts/", diff --git a/src/test/Operation.t.sol b/src/test/Operation.t.sol index 1d14e2f9..dbfd8183 100644 --- a/src/test/Operation.t.sol +++ b/src/test/Operation.t.sol @@ -26,7 +26,9 @@ contract OperationTest is Setup { mintAndDepositIntoStrategy(strategy, user, _amount); // TODO: Implement logic so totalDebt is _amount and totalIdle = 0. - checkStrategyTotals(strategy, _amount, 0, _amount); + assertEq(strategy.totalAssets(), _amount, "!totalAssets"); + assertEq(strategy.totalDebt(), 0, "!totalDebt"); + assertEq(strategy.totalIdle(), _amount, "!totalIdle"); // Earn Interest skip(1 days); @@ -65,7 +67,9 @@ contract OperationTest is Setup { mintAndDepositIntoStrategy(strategy, user, _amount); // TODO: Implement logic so totalDebt is _amount and totalIdle = 0. - checkStrategyTotals(strategy, _amount, 0, _amount); + assertEq(strategy.totalAssets(), _amount, "!totalAssets"); + assertEq(strategy.totalDebt(), 0, "!totalDebt"); + assertEq(strategy.totalIdle(), _amount, "!totalIdle"); // Earn Interest skip(1 days); @@ -111,7 +115,9 @@ contract OperationTest is Setup { mintAndDepositIntoStrategy(strategy, user, _amount); // TODO: Implement logic so totalDebt is _amount and totalIdle = 0. - checkStrategyTotals(strategy, _amount, 0, _amount); + assertEq(strategy.totalAssets(), _amount, "!totalAssets"); + assertEq(strategy.totalDebt(), 0, "!totalDebt"); + assertEq(strategy.totalIdle(), _amount, "!totalIdle"); // Earn Interest skip(1 days); diff --git a/src/test/Shutdown.t.sol b/src/test/Shutdown.t.sol index 9029f9b7..d30b1f76 100644 --- a/src/test/Shutdown.t.sol +++ b/src/test/Shutdown.t.sol @@ -15,7 +15,9 @@ contract ShutdownTest is Setup { mintAndDepositIntoStrategy(strategy, user, _amount); // TODO: Implement logic so totalDebt is _amount and totalIdle = 0. - checkStrategyTotals(strategy, _amount, 0, _amount); + assertEq(strategy.totalAssets(), _amount, "!totalAssets"); + assertEq(strategy.totalDebt(), 0, "!totalDebt"); + assertEq(strategy.totalIdle(), _amount, "!totalIdle"); // Earn Interest skip(1 days); @@ -25,7 +27,9 @@ contract ShutdownTest is Setup { strategy.shutdownStrategy(); // TODO: Implement logic so totalDebt is _amount and totalIdle = 0. - checkStrategyTotals(strategy, _amount, 0, _amount); + assertEq(strategy.totalAssets(), _amount, "!totalAssets"); + assertEq(strategy.totalDebt(), 0, "!totalDebt"); + assertEq(strategy.totalIdle(), _amount, "!totalIdle"); // Make sure we can still withdraw the full amount uint256 balanceBefore = asset.balanceOf(user);