Stabilize height tests

This commit is contained in:
Simon Warta
2020-06-08 10:24:05 +02:00
parent ae043aae69
commit 61d655a269
2 changed files with 10 additions and 4 deletions
+5 -2
View File
@@ -21,6 +21,8 @@ import {
wasmdEnabled,
} from "./testutils.spec";
const blockTime = 1_000; // ms
const guest = {
address: "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej",
};
@@ -92,9 +94,10 @@ describe("CosmWasmClient", () => {
const height2 = await client.getHeight();
expect(height2).toBeGreaterThan(0);
await sleep(1_000);
await sleep(blockTime);
const height3 = await client.getHeight();
expect(height3).toEqual(height2 + 1);
expect(height3).toBeGreaterThanOrEqual(height2 + 1);
expect(height3).toBeLessThanOrEqual(height2 + 2);
expect(blockLatestSpy).toHaveBeenCalledTimes(1);
expect(authAccountsSpy).toHaveBeenCalledTimes(2);
+5 -2
View File
@@ -17,6 +17,8 @@ import {
} from "./testutils.spec";
import { MsgSend, StdFee } from "./types";
const blockTime = 1_000; // ms
const guest = {
address: "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej",
};
@@ -80,9 +82,10 @@ describe("CosmosClient", () => {
const height2 = await client.getHeight();
expect(height2).toBeGreaterThan(0);
await sleep(1_000);
await sleep(blockTime);
const height3 = await client.getHeight();
expect(height3).toEqual(height2 + 1);
expect(height3).toBeGreaterThanOrEqual(height2 + 1);
expect(height3).toBeLessThanOrEqual(height2 + 2);
expect(blockLatestSpy).toHaveBeenCalledTimes(1);
expect(authAccountsSpy).toHaveBeenCalledTimes(3);