mirror of
https://github.com/cosmos/cosmjs.git
synced 2025-03-10 21:49:15 +00:00
Stabilize "gets height via last block"
This commit is contained in:
parent
2292de6e19
commit
6acdb3051a
@ -72,9 +72,10 @@ describe("CosmWasmClient", () => {
|
||||
|
||||
const height1 = await client.getHeight();
|
||||
expect(height1).toBeGreaterThan(0);
|
||||
await sleep(1_000);
|
||||
await sleep(blockTime * 1.3); // tolerate chain being 30% slower than expected
|
||||
const height2 = await client.getHeight();
|
||||
expect(height2).toEqual(height1 + 1);
|
||||
expect(height2).toBeGreaterThanOrEqual(height1 + 1);
|
||||
expect(height2).toBeLessThanOrEqual(height1 + 2);
|
||||
|
||||
expect(blockLatestSpy).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
@ -60,9 +60,10 @@ describe("CosmosClient", () => {
|
||||
|
||||
const height1 = await client.getHeight();
|
||||
expect(height1).toBeGreaterThan(0);
|
||||
await sleep(1_000);
|
||||
await sleep(blockTime * 1.3); // tolerate chain being 30% slower than expected
|
||||
const height2 = await client.getHeight();
|
||||
expect(height2).toEqual(height1 + 1);
|
||||
expect(height2).toBeGreaterThanOrEqual(height1 + 1);
|
||||
expect(height2).toBeLessThanOrEqual(height1 + 2);
|
||||
|
||||
expect(blockLatestSpy).toHaveBeenCalledTimes(2);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user