Skip to content

Commit

Permalink
test: refactor branches in withdrawMultiple (#1104)
Browse files Browse the repository at this point in the history
  • Loading branch information
PaulRBerg authored Dec 2, 2024
1 parent b5d35c4 commit b2b3328
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ contract WithdrawMultiple_Integration_Concrete_Test is Integration_Test {
_;
}

function test_WhenOneStreamIDReverts()
function test_WhenOneStreamReverts()
external
whenNoDelegateCall
whenEqualArraysLength
Expand All @@ -90,7 +90,7 @@ contract WithdrawMultiple_Integration_Concrete_Test is Integration_Test {
// Run the test with the caller provided in {whenCallerAuthorizedForAllStreams}.
resetPrank({ msgSender: caller });

// It should emit {WithdrawFromLockupStream} events for first two streams.
// It should emit {WithdrawFromLockupStream} events for non-reverting streams.
vm.expectEmit({ emitter: address(lockup) });
emit ISablierLockupBase.WithdrawFromLockupStream({
streamId: withdrawMultipleStreamIds[0],
Expand All @@ -106,7 +106,7 @@ contract WithdrawMultiple_Integration_Concrete_Test is Integration_Test {
amount: withdrawAmounts[1]
});

// It should emit {InvalidWithdrawalInWithdrawMultiple} event for third stream.
// It should emit {InvalidWithdrawalInWithdrawMultiple} event for reverting stream.
vm.expectEmit({ emitter: address(lockup) });
emit ISablierLockupBase.InvalidWithdrawalInWithdrawMultiple({
streamId: withdrawMultipleStreamIds[2],
Expand All @@ -118,17 +118,17 @@ contract WithdrawMultiple_Integration_Concrete_Test is Integration_Test {
)
});

// Make the withdrawals with overdrawn withdraw amount for the third stream.
// Make the withdrawals with overdrawn withdraw amount for reverting stream.
withdrawAmounts[2] = MAX_UINT128;
lockup.withdrawMultiple({ streamIds: withdrawMultipleStreamIds, amounts: withdrawAmounts });

// It should update the withdrawn amounts only for first two streams.
// It should update the withdrawn amounts only for non-reverting streams.
assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[0]), withdrawAmounts[0], "withdrawnAmount0");
assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[1]), withdrawAmounts[1], "withdrawnAmount1");
assertEq(lockup.getWithdrawnAmount(withdrawMultipleStreamIds[2]), 0, "withdrawnAmount2");
}

function test_WhenNoStreamIDsRevert()
function test_WhenNoStreamsRevert()
external
whenNoDelegateCall
whenEqualArraysLength
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ WithdrawMultiple_Integration_Concrete_Test
├── when zero array length
│ └── it should do nothing
└── when non zero array length
├── when one stream ID reverts
│ ├── it should emit {WithdrawFromLockupStream} events for first two streams
│ ├── it should emit {InvalidWithdrawalInWithdrawMultiple} event for third stream
│ └── it should update the withdrawn amounts only for first two streams
└── when no stream IDs revert
├── when one stream reverts
│ ├── it should emit {WithdrawFromLockupStream} events for non-reverting streams
│ ├── it should emit {InvalidWithdrawalInWithdrawMultiple} event for reverting stream
│ └── it should update the withdrawn amounts only for non-reverting streams
└── when no streams revert
├── it should make the withdrawals on all streams
├── it should update the statuses
├── it should update the withdrawn amounts
Expand Down

0 comments on commit b2b3328

Please sign in to comment.