Skip to content

Commit

Permalink
✅ Add test for debit zap with insufficient balance
Browse files Browse the repository at this point in the history
  • Loading branch information
JaredBorders committed Jan 18, 2024
1 parent 802bdfa commit 7dcd087
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions test/Credit.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -239,4 +239,30 @@ contract Debit is CreditTest {

vm.stopPrank();
}

function test_debit_zap_InsufficientBalance() public {
uint256 decimalsFactor = 10 ** (18 - USDC.decimals());

deal(address(USDC), ACTOR, SMALLEST_AMOUNT);

vm.startPrank(ACTOR);

USDC.approve(address(engine), type(uint256).max);

engine.creditAccountZap({
_accountId: accountId,
_amount: SMALLEST_AMOUNT
});

vm.expectRevert(
abi.encodeWithSelector(IEngine.InsufficientCredit.selector)
);

engine.debitAccountZap({
_accountId: accountId,
_amount: (SMALLEST_AMOUNT * decimalsFactor) + 1
});

vm.stopPrank();
}
}

0 comments on commit 7dcd087

Please sign in to comment.