Update bonds test
All checks were successful
Lint & Build / lint_and_build (20.x) (pull_request) Successful in 1m51s
Tests / sdk_tests (pull_request) Successful in 21m55s

This commit is contained in:
IshaVenikar 2024-09-06 09:35:58 +05:30
parent 91a4792346
commit adf39a4089

View File

@ -13,6 +13,7 @@ jest.setTimeout(90 * 1000);
const bondTests = () => {
let registry: Registry;
let bond: any;
const publishNewWatcherVersion = async (bondId: string) => {
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
@ -28,6 +29,8 @@ const bondTests = () => {
let bondId = await registry.getNextBondId(privateKey);
expect(bondId).toBeDefined();
await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, privateKey, fee);
[bond] = await registry.getBondsByIds([bondId]);
});
describe('With bond created', () => {
@ -68,15 +71,16 @@ const bondTests = () => {
const { id: bondId2 } = await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, otherAccount.getPrivateKey(), fee);
const [owner1Bonds] = await registry.queryBondsByOwner(bond1.owner);
expect(owner1Bonds.bonds).toHaveLength(2);
const owner1Bond = owner1Bonds.bonds.filter((bond: any) => bond.id === bond1.id);
expect(owner1Bond).toBeDefined();
const [owner1Bonds] = await registry.queryBondsByOwner(bond.owner);
const owner1Bond1 = owner1Bonds.bonds.filter((b: any) => b.id === bond.id);
const owner1Bond2 = owner1Bonds.bonds.filter((b: any) => b.id === bond1.id);
expect(owner1Bond1).toBeDefined();
expect(owner1Bond2).toBeDefined();
const [bond2] = await registry.getBondsByIds([bondId2]);
const [owner2Bonds] = await registry.queryBondsByOwner(bond2.owner);
expect(owner2Bonds.bonds).toHaveLength(1);
const owner2Bond = owner2Bonds.bonds.filter((bond: any) => bond.id === bond2.id);
const owner2Bond = owner2Bonds.bonds.filter((b: any) => b.id === bondId2);
expect(owner2Bond).toBeDefined();
});