From a6f5bf8c261f048e5ab58ff0f74b3cc8d62f6bca Mon Sep 17 00:00:00 2001 From: Shiven <50408041+alfheimrShiven@users.noreply.github.com> Date: Mon, 25 Sep 2023 05:47:23 +0530 Subject: [PATCH] DRY was missed: depositedCollateral modifier used in testRevertsIfMintAmountBreaksHelthFactor() test (#42) * depositedCollateral modifier used in testRevertsIfMintAmountBreaksHealthFactor() test * resolved conflict --- test/unit/DSCEngineTest.t.sol | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/test/unit/DSCEngineTest.t.sol b/test/unit/DSCEngineTest.t.sol index 5dd4fbe..c3acc62 100644 --- a/test/unit/DSCEngineTest.t.sol +++ b/test/unit/DSCEngineTest.t.sol @@ -231,16 +231,13 @@ contract DSCEngineTest is StdCheats, Test { vm.stopPrank(); } - function testRevertsIfMintAmountBreaksHealthFactor() public { + function testRevertsIfMintAmountBreaksHealthFactor() public depositedCollateral{ // 0xe580cc6100000000000000000000000000000000000000000000000006f05b59d3b20000 // 0xe580cc6100000000000000000000000000000000000000000000003635c9adc5dea00000 (, int256 price,,,) = MockV3Aggregator(ethUsdPriceFeed).latestRoundData(); amountToMint = (amountCollateral * (uint256(price) * dsce.getAdditionalFeedPrecision())) / dsce.getPrecision(); vm.startPrank(user); - ERC20Mock(weth).approve(address(dsce), amountCollateral); - dsce.depositCollateral(weth, amountCollateral); - uint256 expectedHealthFactor = dsce.calculateHealthFactor(amountToMint, dsce.getUsdValue(weth, amountCollateral)); vm.expectRevert(abi.encodeWithSelector(DSCEngine.DSCEngine__BreaksHealthFactor.selector, expectedHealthFactor));