Skip to content

Commit

Permalink
test for transfer events on swap
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahZinsmeister committed Jan 31, 2020
1 parent e382d70 commit 1df07b3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/UniswapV2Exchange.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ describe('UniswapV2Exchange', () => {
const expectedOutputAmount = bigNumberify('1662497915624478906')
await token0.transfer(exchange.address, swapAmount)
await expect(exchange.swap(token0.address, expectedOutputAmount, wallet.address, overrides))
.to.emit(token1, 'Transfer')
.withArgs(exchange.address, wallet.address, expectedOutputAmount)
.to.emit(exchange, 'Sync')
.withArgs(token0Amount.add(swapAmount), token1Amount.sub(expectedOutputAmount))
.to.emit(exchange, 'Swap')
Expand All @@ -124,6 +126,8 @@ describe('UniswapV2Exchange', () => {
const expectedOutputAmount = bigNumberify('453305446940074565')
await token1.transfer(exchange.address, swapAmount)
await expect(exchange.swap(token1.address, expectedOutputAmount, wallet.address, overrides))
.to.emit(token0, 'Transfer')
.withArgs(exchange.address, wallet.address, expectedOutputAmount)
.to.emit(exchange, 'Sync')
.withArgs(token0Amount.sub(expectedOutputAmount), token1Amount.add(swapAmount))
.to.emit(exchange, 'Swap')
Expand Down

0 comments on commit 1df07b3

Please sign in to comment.