From 0880185a4b9d2337559a7f834dd94b6f50e0419c Mon Sep 17 00:00:00 2001 From: IshaVenikar Date: Thu, 22 Aug 2024 12:07:21 +0530 Subject: [PATCH] Add test to check block height for all txs --- src/index.test.ts | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/src/index.test.ts b/src/index.test.ts index 7a3c1bf..eeffcdc 100644 --- a/src/index.test.ts +++ b/src/index.test.ts @@ -44,9 +44,7 @@ const registryTests = () => { expect(quantity).toBe('10000'); }); - test('Get transaction info.', async () => { - const bondAmount = '100000'; - + test('Send batch txs.', async () => { const accounts = await createAccounts(10); for (let i = 0; i < 10; i++) { @@ -55,11 +53,16 @@ const registryTests = () => { await registry.sendCoins({ denom: DENOM, amount, destinationAddress: accounts[i].address }, fromAccount, fee); } - const bondPromises = accounts.map((account) => - registry.createBond({ denom: DENOM, amount: bondAmount }, account.getPrivateKey(), fee) - ); - await Promise.all(bondPromises); + await Promise.all(accounts.map((account) => + registry.createBond({ denom: DENOM, amount: '100000' }, account.getPrivateKey(), fee) + )); + + const laconicClient = await registry.getLaconicClient(accounts[0]); + const bondTx = await laconicClient.searchTx('message.action="/cerc.bond.v1.MsgCreateBond"'); + + const expectedBlockHeight = bondTx[0].height; + expect(bondTx.every(tx => tx.height === expectedBlockHeight)).toBe(true); }); const createAccounts = async (numAccounts: number): Promise => {