Update bonds test
This commit is contained in:
parent
91a4792346
commit
adf39a4089
@ -13,6 +13,7 @@ jest.setTimeout(90 * 1000);
|
|||||||
|
|
||||||
const bondTests = () => {
|
const bondTests = () => {
|
||||||
let registry: Registry;
|
let registry: Registry;
|
||||||
|
let bond: any;
|
||||||
|
|
||||||
const publishNewWatcherVersion = async (bondId: string) => {
|
const publishNewWatcherVersion = async (bondId: string) => {
|
||||||
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
let watcher = await ensureUpdatedConfig(WATCHER_YML_PATH);
|
||||||
@ -28,6 +29,8 @@ const bondTests = () => {
|
|||||||
let bondId = await registry.getNextBondId(privateKey);
|
let bondId = await registry.getNextBondId(privateKey);
|
||||||
expect(bondId).toBeDefined();
|
expect(bondId).toBeDefined();
|
||||||
await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, privateKey, fee);
|
await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, privateKey, fee);
|
||||||
|
|
||||||
|
[bond] = await registry.getBondsByIds([bondId]);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('With bond created', () => {
|
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 { id: bondId2 } = await registry.createBond({ denom: DENOM, amount: BOND_AMOUNT }, otherAccount.getPrivateKey(), fee);
|
||||||
|
|
||||||
const [owner1Bonds] = await registry.queryBondsByOwner(bond1.owner);
|
const [owner1Bonds] = await registry.queryBondsByOwner(bond.owner);
|
||||||
expect(owner1Bonds.bonds).toHaveLength(2);
|
const owner1Bond1 = owner1Bonds.bonds.filter((b: any) => b.id === bond.id);
|
||||||
const owner1Bond = owner1Bonds.bonds.filter((bond: any) => bond.id === bond1.id);
|
const owner1Bond2 = owner1Bonds.bonds.filter((b: any) => b.id === bond1.id);
|
||||||
expect(owner1Bond).toBeDefined();
|
expect(owner1Bond1).toBeDefined();
|
||||||
|
expect(owner1Bond2).toBeDefined();
|
||||||
|
|
||||||
const [bond2] = await registry.getBondsByIds([bondId2]);
|
const [bond2] = await registry.getBondsByIds([bondId2]);
|
||||||
const [owner2Bonds] = await registry.queryBondsByOwner(bond2.owner);
|
const [owner2Bonds] = await registry.queryBondsByOwner(bond2.owner);
|
||||||
expect(owner2Bonds.bonds).toHaveLength(1);
|
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();
|
expect(owner2Bond).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user