From a0ee52e8d9e4030fcc64434f47c42ca2244aa9ad Mon Sep 17 00:00:00 2001 From: Bartek Date: Tue, 15 Oct 2024 18:01:28 +0200 Subject: [PATCH] fix test --- tests/integration/eth.test.ts | 31 +++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/tests/integration/eth.test.ts b/tests/integration/eth.test.ts index fff74171e..bd08b07a7 100644 --- a/tests/integration/eth.test.ts +++ b/tests/integration/eth.test.ts @@ -27,6 +27,7 @@ import { fundParentSigner, fundChildSigner, mineUntilStop, + prettyLog, skipIfMainnet, } from './testHelpers' import { ChildToParentMessage } from '../../src/lib/message/ChildToParentMessage' @@ -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() ) })