Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update DSCEngineTest.t.sol - testCanRedeemCollateral() #114

Merged
merged 1 commit into from
Feb 23, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions test/unit/DSCEngineTest.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,15 @@ contract DSCEngineTest is StdCheats, Test {

function testCanRedeemCollateral() public depositedCollateral {
vm.startPrank(user);
uint256 userBalanceBeforeRedeem = dsce.getCollateralBalanceOfUser(user, weth);
assertEq(userBalanceBeforeRedeem, amountCollateral);
dsce.redeemCollateral(weth, amountCollateral);
uint256 userBalance = ERC20Mock(weth).balanceOf(user);
assertEq(userBalance, amountCollateral);
uint256 userBalanceAfterRedeem = dsce.getCollateralBalanceOfUser(user, weth);
assertEq(userBalanceAfterRedeem, 0);
vm.stopPrank();
}


function testEmitCollateralRedeemedWithCorrectArgs() public depositedCollateral {
vm.expectEmit(true, true, true, true, address(dsce));
emit CollateralRedeemed(user, user, weth, amountCollateral);
Expand Down
Loading