message: Create blocks for Tendermint client tests
diff: @@ -14,8 +14,12 @@ import * as responses from "./responses";
  import { HttpClient, RpcClient, WebsocketClient } from "./rpcclients";
  import { TxBytes } from "./types";
  +function tendermintEnabled(): boolean {
  + return !!process.env.TENDERMINT_ENABLED;
  +}
  +
  function pendingWithoutTendermint(): void {
  - if (!process.env.TENDERMINT_ENABLED) {
  + if (!tendermintEnabled()) {
  pending("Set TENDERMINT_ENABLED to enable tendermint-based tests");
  }
  }
  @@ -124,7 +128,8 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  client.disconnect();
  });
  - it("can call status", async () => {
  + describe("status", () => {
  + it("works", async () => {
  pendingWithoutTendermint();
  const client = new Client(rpcFactory(), adaptor);
  @@ -138,7 +143,9 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  client.disconnect();
  });
  + });
  + describe("tx", () => {
  it("can query a tx properly", async () => {
  pendingWithoutTendermint();
  const client = new Client(rpcFactory(), adaptor);
  @@ -191,17 +198,19 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  client.disconnect();
  });
  + });
  - it("can paginate over txSearch results", async () => {
  - pendingWithoutTendermint();
  - const client = new Client(rpcFactory(), adaptor);
  + describe("txSearch", () => {
  + const key = randomString();
  - const find = randomString();
  - const query = buildQuery({ tags: [{ key: "app.key", value: find }] });
  + beforeAll(async () => {
  + if (tendermintEnabled()) {
  + const client = new Client(rpcFactory(), adaptor);
  + // eslint-disable-next-line no-inner-declarations
  async function sendTx(): Promise<void> {
  const me = randomString();
  - const tx = buildKvTx(find, me);
  + const tx = buildKvTx(key, me);
  const txRes = await client.broadcastTxCommit({ tx: tx });
  expect(responses.broadcastTxCommitSuccess(txRes)).toEqual(true);
  @@ -214,7 +223,17 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  await sendTx();
  await sendTx();
  + client.disconnect();
  +
  await tendermintSearchIndexUpdated();
  + }
  + });
  +
  + it("can paginate over txSearch results", async () => {
  + pendingWithoutTendermint();
  + const client = new Client(rpcFactory(), adaptor);
  +
  + const query = buildQuery({ tags: [{ key: "app.key", value: key }] });
  // expect one page of results
  const s1 = await client.txSearch({ query: query, page: 1, per_page: 2 });
  @@ -226,7 +245,15 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  expect(s2.totalCount).toEqual(3);
  expect(s2.txs.length).toEqual(1);
  - // and all together now
  + client.disconnect();
  + });
  +
  + it("can get all search results in one call", async () => {
  + pendingWithoutTendermint();
  + const client = new Client(rpcFactory(), adaptor);
  +
  + const query = buildQuery({ tags: [{ key: "app.key", value: key }] });
  +
  const sall = await client.txSearchAll({ query: query, per_page: 2 });
  expect(sall.totalCount).toEqual(3);
  expect(sall.txs.length).toEqual(3);
  @@ -237,6 +264,7 @@ function defaultTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor): void {
  client.disconnect();
  });
  + });
  }
  function websocketTestSuite(rpcFactory: () => RpcClient, adaptor: Adaptor, appCreator: string): void {
  