From 4b34249d77dacbb063ad73d412f1ae05e095452f Mon Sep 17 00:00:00 2001 From: willclarktech Date: Tue, 21 Jul 2020 15:55:28 +0200 Subject: [PATCH] sdk38: Add additional staking validators test --- packages/sdk38/src/lcdapi/staking.spec.ts | 40 ++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/packages/sdk38/src/lcdapi/staking.spec.ts b/packages/sdk38/src/lcdapi/staking.spec.ts index b4edfb2c..93eb4fd9 100644 --- a/packages/sdk38/src/lcdapi/staking.spec.ts +++ b/packages/sdk38/src/lcdapi/staking.spec.ts @@ -47,7 +47,7 @@ describe("StakingExtension", () => { }); }); - it("can filter by status", async () => { + it("can filter by status with no results", async () => { pendingWithoutWasmd(); const client = makeStakingClient(wasmd.endpoint); const response = await client.staking.validators({ status: "unbonded" }); @@ -56,6 +56,44 @@ describe("StakingExtension", () => { result: [], }); }); + + it("can filter by status with some results", async () => { + pendingWithoutWasmd(); + const client = makeStakingClient(wasmd.endpoint); + const response = await client.staking.validators({ status: "bonded" }); + expect(response).toEqual({ + height: jasmine.stringMatching(nonNegativeIntegerMatcher), + result: [ + { + operator_address: "cosmosvaloper1gjvanqxc774u6ed9thj4gpn9gj5zus5u32enqn", + consensus_pubkey: + "cosmosvalconspub1zcjduepqau36ht2r742jh230pxlu4wjmwcmkwpeqava80acphsu87vt5xlpqx6g7qh", + jailed: false, + status: 2, + tokens: "250000000", + delegator_shares: "250000000.000000000000000000", + description: { + moniker: "testing", + identity: "", + website: "", + security_contact: "", + details: "", + }, + unbonding_height: "0", + unbonding_time: "1970-01-01T00:00:00Z", + commission: { + commission_rates: { + rate: "0.100000000000000000", + max_rate: "0.200000000000000000", + max_change_rate: "0.010000000000000000", + }, + update_time: "2020-06-03T06:01:17.4747987Z", + }, + min_self_delegation: "1", + }, + ], + }); + }); }); describe("pool", () => {