Skip to content

Commit 54e9b42

Browse files
authored
Merge pull request #1823 from cosmos/pending-tests-follow-up
Pending tests follow up
2 parents 51d725a + 8ad6506 commit 54e9b42

30 files changed

+117
-300
lines changed

packages/cosmwasm-stargate/src/cosmwasmclient.searchtx.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe("CosmWasmClient.getTx and .searchTx", () => {
106106
let sendSuccessful: TestTxSend | undefined;
107107

108108
beforeAll(async () => {
109-
if (wasmdEnabled()) {
109+
if (wasmdEnabled) {
110110
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
111111
const client = await CosmWasmClient.connect(wasmd.endpoint);
112112
const unsuccessfulRecipient = makeRandomAddress();

packages/cosmwasm-stargate/src/cosmwasmclient.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ describe("CosmWasmClient", () => {
354354
let contract: HackatomInstance | undefined;
355355

356356
beforeAll(async () => {
357-
if (wasmdEnabled()) {
357+
if (wasmdEnabled) {
358358
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
359359
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet);
360360
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);
@@ -410,7 +410,7 @@ describe("CosmWasmClient", () => {
410410
let contract: HackatomInstance | undefined;
411411

412412
beforeAll(async () => {
413-
if (wasmdEnabled()) {
413+
if (wasmdEnabled) {
414414
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
415415
const client = await SigningCosmWasmClient.connectWithSigner(wasmd.endpoint, wallet);
416416
const { codeId } = await client.upload(alice.address0, getHackatom().data, defaultUploadFee);

packages/cosmwasm-stargate/src/modules/wasm/queries.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ describe("WasmExtension", () => {
131131
let hackatomContractAddress: string | undefined;
132132

133133
beforeAll(async () => {
134-
if (wasmdEnabled()) {
134+
if (wasmdEnabled) {
135135
const wallet = await DirectSecp256k1HdWallet.fromMnemonic(alice.mnemonic, { prefix: wasmd.prefix });
136136
const result = await uploadContract(wallet, hackatom);
137137
assertIsDeliverTxSuccess(result);

packages/cosmwasm-stargate/src/testutils.spec.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -144,12 +144,10 @@ export const deployedIbcReflect = {
144144
],
145145
};
146146

147-
export function wasmdEnabled(): boolean {
148-
return !!process.env.WASMD_ENABLED;
149-
}
147+
export const wasmdEnabled: boolean = !!globalThis.process?.env.WASMD_ENABLED;
150148

151149
export function pendingWithoutWasmd(): void {
152-
if (!wasmdEnabled()) {
150+
if (!wasmdEnabled) {
153151
pending("Set WASMD_ENABLED to enable Wasmd-based tests");
154152
return;
155153
}

packages/faucet/src/api/webserver.spec.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,10 @@ import { makeCosmoshubPath } from "@cosmjs/stargate";
22
import { sleep } from "@cosmjs/utils";
33

44
import { Faucet } from "../faucet";
5+
import { simappEnabled } from "../testutils.spec";
56
import { TokenConfiguration } from "../tokenmanager";
67
import { ChainConstants, Webserver } from "./webserver";
78

8-
function pendingWithoutSimapp(): void {
9-
if (!process.env.SIMAPP47_ENABLED && !process.env.SIMAPP50_ENABLED) {
10-
pending("Set SIMAPP{47,50}_ENABLED to enable Stargate node-based tests");
11-
return;
12-
}
13-
}
14-
159
const defaultTokenConfig: TokenConfiguration = {
1610
bankTokens: ["ucosm", "ustake"],
1711
};
@@ -22,7 +16,7 @@ const faucetMnemonic =
2216

2317
const testingPort = 62222;
2418

25-
describe("Webserver", () => {
19+
(simappEnabled ? describe : xdescribe)("Webserver", () => {
2620
const pathBuilder = makeCosmoshubPath;
2721

2822
const rpcUrl = "http://localhost:26658";
@@ -38,7 +32,6 @@ describe("Webserver", () => {
3832
});
3933

4034
it("can be constructed and started", async () => {
41-
pendingWithoutSimapp();
4235
const faucet = await Faucet.make(
4336
rpcUrl,
4437
defaultAddressPrefix,

packages/faucet/src/faucet.spec.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ import { makeCosmoshubPath, StargateClient } from "@cosmjs/stargate";
44
import { assert } from "@cosmjs/utils";
55

66
import { Faucet } from "./faucet";
7+
import { simappEnabled } from "./testutils.spec";
78
import { TokenConfiguration } from "./tokenmanager";
89

9-
const enabled = !!(globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED);
10-
1110
const defaultTokenConfig: TokenConfiguration = {
1211
bankTokens: ["ucosm", "ustake"],
1312
};
@@ -20,7 +19,7 @@ function makeRandomAddress(): string {
2019
const faucetMnemonic =
2120
"economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone";
2221

23-
(enabled ? describe : xdescribe)("Faucet", () => {
22+
(simappEnabled ? describe : xdescribe)("Faucet", () => {
2423
const pathBuilder = makeCosmoshubPath;
2524

2625
const apiUrl = "http://localhost:26658";
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
export const simappEnabled = !!(
2+
globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED
3+
);

packages/ledger-amino/src/ledgersigner.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ async function createTransport(): Promise<Transport> {
3838
return TransportClass.create(interactiveTimeout, interactiveTimeout);
3939
}
4040

41-
(ledgerEnabled() ? describe : xdescribe)("LedgerSigner", () => {
41+
(ledgerEnabled ? describe : xdescribe)("LedgerSigner", () => {
4242
const defaultChainId = "testing";
4343
const defaultFee = calculateFee(100_000, "0.025ucosm");
4444
const defaultMemo = "Some memo";
@@ -48,7 +48,7 @@ async function createTransport(): Promise<Transport> {
4848
let transport: Transport;
4949

5050
beforeAll(async () => {
51-
if (simappEnabled()) {
51+
if (simappEnabled) {
5252
const wallet = await Secp256k1HdWallet.fromMnemonic(faucet.mnemonic);
5353
const client = await SigningStargateClient.connectWithSigner(simapp.endpoint, wallet);
5454
const amount = coins(226644, "ucosm");
@@ -147,7 +147,7 @@ async function createTransport(): Promise<Transport> {
147147
interactiveTimeout,
148148
);
149149

150-
(simappEnabled() ? it : xit)(
150+
(simappEnabled ? it : xit)(
151151
"creates signature accepted by Stargate backend",
152152
async () => {
153153
const signer = new LedgerSigner(transport, {

packages/ledger-amino/src/testutils.spec.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ export const faucet = {
88
address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
99
};
1010

11-
export function ledgerEnabled(): boolean {
12-
return !!globalThis.process?.env.LEDGER_ENABLED;
13-
}
11+
export const ledgerEnabled: boolean = !!globalThis.process?.env.LEDGER_ENABLED;
1412

15-
export function simappEnabled(): boolean {
16-
return !!(globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED);
17-
}
13+
export const simappEnabled: boolean = !!(
14+
globalThis.process?.env.SIMAPP47_ENABLED || globalThis.process?.env.SIMAPP50_ENABLED
15+
);
1816

1917
export const simapp = {
2018
endpoint: "ws://localhost:26658",

packages/socket/src/queueingstreamingsocket.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ describe("QueueingStreamingSocket", () => {
146146
});
147147
});
148148

149-
describe("connectionStatus", () => {
149+
(enabled ? describe : xdescribe)("connectionStatus", () => {
150150
it("exposes connection status", async () => {
151151
let done!: (() => void) & { fail: (e?: any) => void };
152152
const ret = new Promise<void>((resolve, reject) => {

0 commit comments

Comments
 (0)