Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
brtkx committed Oct 15, 2024
1 parent 4122527 commit a0ee52e
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions tests/integration/eth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import {
fundParentSigner,
fundChildSigner,
mineUntilStop,
prettyLog,
skipIfMainnet,
} from './testHelpers'
import { ChildToParentMessage } from '../../src/lib/message/ChildToParentMessage'
Expand Down Expand Up @@ -138,26 +139,32 @@ describe('Ether', async () => {
'balance failed to update after eth deposit'
)

const l1ToL2Messages = await rec.getEthDeposits(childSigner.provider!)
expect(l1ToL2Messages.length).to.eq(1, 'failed to find 1 l1 to l2 message')
const l1ToL2Message = l1ToL2Messages[0]
const waitResult = await rec.waitForChildTransactionReceipt(
childSigner.provider!
)

const walletAddress = await parentSigner.getAddress()
expect(l1ToL2Message.to).to.eq(walletAddress, 'message inputs value error')
expect(l1ToL2Message.value.toString(), 'message inputs value error').to.eq(
parseEther(amount).toString()
)

const parentToChildMessages = await rec.getEthDeposits(
childSigner.provider!
)
expect(parentToChildMessages.length).to.eq(
1,
'failed to find 1 parent-to-child message'
const parentToChildMessage = parentToChildMessages[0]

expect(parentToChildMessage.to).to.eq(
walletAddress,
'message inputs value error'
)
expect(
parentToChildMessage.value.toString(),
'message inputs value error'
).to.eq(parseEther(amount).toString())

expect(waitResult.complete).to.eq(true, 'eth deposit not complete')
expect(waitResult.childTxReceipt).to.exist
expect(waitResult.childTxReceipt).to.not.be.null

const testWalletL2EthBalance = await childSigner.getBalance()
expect(testWalletL2EthBalance.toString(), 'final balance').to.eq(
const testWalletChildEthBalance = await childSigner.getBalance()
expect(testWalletChildEthBalance.toString(), 'final balance').to.eq(
parseEther(amount).toString()
)
})
Expand Down

0 comments on commit a0ee52e

Please sign in to comment.