Skip to content

Commit

Permalink
test: missing case for joinswapPoolAmountOut
Browse files Browse the repository at this point in the history
  • Loading branch information
0xteddybear committed Jul 24, 2024
1 parent fcf63af commit 634baee
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/unit/BPool/BPool_JoinswapPoolAmountOut.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,13 @@ contract BPoolJoinswapPoolAmountOut is BPoolBase, BNum {
bPool.joinswapPoolAmountOut(makeAddr('unknown token'), poolAmountOut, maxTokenIn);
}

function test_RevertWhen_TokenAmountInIsZero() external {
// it should revert
vm.expectRevert(IBPool.BPool_InvalidTokenAmountIn.selector);
// using a small amount that rounds to zero
bPool.joinswapPoolAmountOut(tokenIn, 20, type(uint256).max);
}

function test_RevertWhen_TokenAmountInExceedsMaxRatio() external {
// it should revert
vm.expectRevert(IBPool.BPool_TokenAmountInAboveMaxRatio.selector);
Expand Down
2 changes: 2 additions & 0 deletions test/unit/BPool/BPool_JoinswapPoolAmountOut.tree
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ BPool::JoinswapPoolAmountOut
│ └── it should revert
├── when token in is not bound
│ └── it should revert
├── when token amount in is zero
│ └── it should revert
├── when token amount in exceeds max ratio
│ └── it should revert
├── when calculated token amount in is more than expected
Expand Down

0 comments on commit 634baee

Please sign in to comment.