Add test to send multiple txs

This commit is contained in:
IshaVenikar 2024-08-22 11:40:44 +05:30
parent f93a297857
commit cf5bb9e7de

View File

@ -43,6 +43,37 @@ const registryTests = () => {
expect(type).toBe(DENOM);
expect(quantity).toBe('10000');
});
test('Get transaction info.', async () => {
const bondAmount = '100000';
const accounts = await createAccounts(10);
for (let i = 0; i < 10; i++) {
const amount = (10 ** (15 - i)).toString();
const fromAccount = i === 0 ? privateKey : accounts[i - 1].getPrivateKey();
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);
});
const createAccounts = async (numAccounts: number): Promise<Account[]> => {
const accounts: Account[] = [];
for (let i = 0; i < numAccounts; i++) {
const mnemonic = Account.generateMnemonic();
const account = await Account.generateFromMnemonic(mnemonic);
await account.init();
accounts.push(account);
}
return accounts;
};
};
describe('Registry', registryTests);