Add test to check block height for all txs

This commit is contained in:
IshaVenikar 2024-08-22 12:07:21 +05:30
parent cf5bb9e7de
commit 0880185a4b

View File

@ -44,9 +44,7 @@ const registryTests = () => {
expect(quantity).toBe('10000'); expect(quantity).toBe('10000');
}); });
test('Get transaction info.', async () => { test('Send batch txs.', async () => {
const bondAmount = '100000';
const accounts = await createAccounts(10); const accounts = await createAccounts(10);
for (let i = 0; i < 10; i++) { 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); 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<Account[]> => { const createAccounts = async (numAccounts: number): Promise<Account[]> => {