From 9591c225127a7b5a5301e16e0107c9e97f4756f3 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Tue, 18 Aug 2020 09:15:21 +0200 Subject: [PATCH] Add future height test --- packages/tendermint-rpc/src/client.spec.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/tendermint-rpc/src/client.spec.ts b/packages/tendermint-rpc/src/client.spec.ts index 8aa7d510..2d44e61d 100644 --- a/packages/tendermint-rpc/src/client.spec.ts +++ b/packages/tendermint-rpc/src/client.spec.ts @@ -178,6 +178,20 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void { client.disconnect(); }); + it("works with maxHeight in the future", async () => { + pendingWithoutTendermint(); + const client = new Client(rpcFactory(), adaptor); + + const height = (await client.status()).syncInfo.latestBlockHeight; + const blockchain = await client.blockchain(undefined, height + 20); + expect(blockchain.lastHeight).toEqual(height); + expect(blockchain.blockMetas.length).toBeGreaterThanOrEqual(2); + expect(blockchain.blockMetas[0].header.height).toEqual(height); + expect(blockchain.blockMetas[1].header.height).toEqual(height - 1); + + client.disconnect(); + }); + it("can limit by minHeight and maxHeight", async () => { pendingWithoutTendermint(); const client = new Client(rpcFactory(), adaptor);