Skip to content

Commit

Permalink
DRY was missed: depositedCollateral modifier used in testRevertsIfMin…
Browse files Browse the repository at this point in the history
…tAmountBreaksHelthFactor() test (#42)

* depositedCollateral modifier used in testRevertsIfMintAmountBreaksHealthFactor() test

* resolved conflict
  • Loading branch information
alfheimrShiven authored Sep 25, 2023
1 parent ac725e2 commit a6f5bf8
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions test/unit/DSCEngineTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit a6f5bf8

Please sign in to comment.