Rename COSMOS_ENABLED to WASMD_ENABLED

This commit is contained in:
Simon Warta 2020-02-17 15:35:29 +01:00
parent a22a201fe7
commit b46b7d7cc7
10 changed files with 89 additions and 97 deletions

View File

@ -85,7 +85,7 @@ jobs:
command: ./scripts/wasmd/init.sh
- run:
environment:
COSMOS_ENABLED: 1
WASMD_ENABLED: 1
SKIP_BUILD: 1
command: yarn test
- run:

View File

@ -23,6 +23,6 @@ To run the entire test suite, you need to run a local blockchain to test against
```sh
./scripts/wasmd/start.sh
./scripts/wasmd/init.sh
COSMOS_ENABLED=1 yarn test
WASMD_ENABLED=1 yarn test
./scripts/wasmd/stop.sh
```

View File

@ -24,9 +24,9 @@ import * as testdata from "./testdata.spec";
const { fromBase64 } = Encoding;
function pendingWithoutCosmos(): void {
if (!process.env.COSMOS_ENABLED) {
return pending("Set COSMOS_ENABLED to enable Cosmos node-based tests");
function pendingWithoutWasmd(): void {
if (!process.env.WASMD_ENABLED) {
return pending("Set WASMD_ENABLED to enable Cosmos node-based tests");
}
}
@ -113,7 +113,7 @@ describe("CosmWasmConnection", () => {
describe("establish", () => {
it("can connect to Cosmos via http", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
expect(connection).toBeTruthy();
connection.disconnect();
@ -122,7 +122,7 @@ describe("CosmWasmConnection", () => {
describe("chainId", () => {
it("displays the chain ID", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
expect(connection.chainId).toEqual(defaultChainId);
connection.disconnect();
@ -131,7 +131,7 @@ describe("CosmWasmConnection", () => {
describe("height", () => {
it("displays the current height", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const height = await connection.height();
expect(height).toBeGreaterThan(0);
@ -141,7 +141,7 @@ describe("CosmWasmConnection", () => {
describe("getToken", () => {
it("displays a given token", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const token = await connection.getToken("COSM" as TokenTicker);
expect(token).toEqual({
@ -153,7 +153,7 @@ describe("CosmWasmConnection", () => {
});
it("resolves to undefined if the token is not supported", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const token = await connection.getToken("whatever" as TokenTicker);
expect(token).toBeUndefined();
@ -163,7 +163,7 @@ describe("CosmWasmConnection", () => {
describe("getAllTokens", () => {
it("resolves to a list of all supported tokens", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const tokens = await connection.getAllTokens();
expect(tokens).toEqual([
@ -199,7 +199,7 @@ describe("CosmWasmConnection", () => {
describe("identifier", () => {
it("calculates tx hash from PostableBytes", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, atomConfig);
const id = await connection.identifier(testdata.signedTxJson);
expect(id).toMatch(/^[0-9A-F]{64}$/);
@ -209,7 +209,7 @@ describe("CosmWasmConnection", () => {
describe("getAccount", () => {
it("gets an empty account by address", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const account = await connection.getAccount({ address: defaultEmptyAddress });
expect(account).toBeUndefined();
@ -217,7 +217,7 @@ describe("CosmWasmConnection", () => {
});
it("gets an account by address", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const account = await connection.getAccount({ address: unusedAccount.address });
assert(account, "Account must be defined");
@ -249,7 +249,7 @@ describe("CosmWasmConnection", () => {
});
it("gets an account by pubkey", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const byAddress = await connection.getAccount({ address: unusedAccount.address });
const byPubkey = await connection.getAccount({ pubkey: unusedAccount.pubkey });
@ -258,7 +258,7 @@ describe("CosmWasmConnection", () => {
});
it("has a pubkey when getting account with transactions", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const account = await connection.getAccount({ address: faucet.address });
expect(account?.pubkey).toEqual(faucet.pubkey);
@ -268,7 +268,7 @@ describe("CosmWasmConnection", () => {
describe("getTx", () => {
it("can get a recently posted transaction", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const profile = new UserProfile();
const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic));
@ -319,7 +319,7 @@ describe("CosmWasmConnection", () => {
});
it("can get an old transaction", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const results = await connection.searchTx({ sentFromOrTo: faucet.address });
@ -360,7 +360,7 @@ describe("CosmWasmConnection", () => {
});
it("throws for non-existent transaction", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000" as TransactionId;
@ -375,7 +375,7 @@ describe("CosmWasmConnection", () => {
describe("integration tests", () => {
it("can post and search for a transaction", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const profile = new UserProfile();
const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic));
@ -465,7 +465,7 @@ describe("CosmWasmConnection", () => {
});
it("can send ERC20 tokens", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const profile = new UserProfile();
const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic));

View File

@ -14,6 +14,6 @@ module.exports = [
path: distdir,
filename: "tests.js",
},
plugins: [new webpack.EnvironmentPlugin(["COSMOS_ENABLED"])],
plugins: [new webpack.EnvironmentPlugin(["WASMD_ENABLED"])],
},
];

View File

@ -9,9 +9,9 @@ import { assert } from "@iov/utils";
import { Faucet } from "./faucet";
import { createUserProfile } from "./profile";
function pendingWithoutCosmos(): void {
if (!process.env.COSMOS_ENABLED) {
return pending("Set COSMOS_ENABLED to enable Cosmos node-based tests");
function pendingWithoutWasmd(): void {
if (!process.env.WASMD_ENABLED) {
return pending("Set WASMD_ENABLED to enable Cosmos node-based tests");
}
}
@ -65,7 +65,7 @@ async function makeProfile(
describe("Faucet", () => {
describe("constructor", () => {
it("can be constructed", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile } = await makeProfile();
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -76,7 +76,7 @@ describe("Faucet", () => {
describe("send", () => {
it("can send bank token", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile, holder } = await makeProfile();
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -103,7 +103,7 @@ describe("Faucet", () => {
});
it("can send ERC20 token", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile, holder } = await makeProfile();
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -132,7 +132,7 @@ describe("Faucet", () => {
describe("refill", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile, distributors } = await makeProfile(1);
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -162,7 +162,7 @@ describe("Faucet", () => {
describe("credit", () => {
it("works for fee token", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile } = await makeProfile(1);
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -181,7 +181,7 @@ describe("Faucet", () => {
});
it("works for stake token", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile } = await makeProfile(1);
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -202,7 +202,7 @@ describe("Faucet", () => {
describe("loadTokenTickers", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile } = await makeProfile();
const faucet = new Faucet(defaultConfig, connection, codec, profile);
@ -214,7 +214,7 @@ describe("Faucet", () => {
describe("loadAccounts", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const connection = await CosmWasmConnection.establish(httpUrl, defaultPrefix, defaultConfig);
const { profile, holder } = await makeProfile();
const faucet = new Faucet(defaultConfig, connection, codec, profile);

View File

@ -11,11 +11,11 @@ import { RestClient } from "./restclient";
import { SigningCosmWasmClient } from "./signingcosmwasmclient";
import cosmoshub from "./testdata/cosmoshub.json";
import {
cosmosEnabled,
getRandomizedHackatom,
makeRandomAddress,
pendingWithoutCosmos,
pendingWithoutWasmd,
tendermintIdMatcher,
wasmdEnabled,
} from "./testutils.spec";
import { CosmosSdkTx, MsgSend, StdFee } from "./types";
@ -55,7 +55,7 @@ describe("CosmWasmClient", () => {
describe("chainId", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
expect(await client.chainId()).toEqual("testing");
});
@ -63,7 +63,7 @@ describe("CosmWasmClient", () => {
describe("getNonce", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
expect(await client.getNonce(unusedAccount.address)).toEqual({
accountNumber: 5,
@ -72,7 +72,7 @@ describe("CosmWasmClient", () => {
});
it("throws for missing accounts", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
const missing = makeRandomAddress();
await client.getNonce(missing).then(
@ -84,7 +84,7 @@ describe("CosmWasmClient", () => {
describe("getAccount", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
expect(await client.getAccount(unusedAccount.address)).toEqual({
address: unusedAccount.address,
@ -99,7 +99,7 @@ describe("CosmWasmClient", () => {
});
it("returns undefined for missing accounts", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
const missing = makeRandomAddress();
expect(await client.getAccount(missing)).toBeUndefined();
@ -108,7 +108,7 @@ describe("CosmWasmClient", () => {
describe("getBlock", () => {
it("works for latest block", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
const response = await client.getBlock();
@ -128,7 +128,7 @@ describe("CosmWasmClient", () => {
});
it("works for block by height", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
const height = parseInt((await client.getBlock()).block.header.height, 10);
const response = await client.getBlock(height - 1);
@ -151,7 +151,7 @@ describe("CosmWasmClient", () => {
describe("getIdentifier", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
expect(await client.getIdentifier(cosmoshub.tx)).toEqual(cosmoshub.id);
});
@ -159,7 +159,7 @@ describe("CosmWasmClient", () => {
describe("postTx", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new CosmWasmClient(httpUrl);
@ -217,7 +217,7 @@ describe("CosmWasmClient", () => {
| undefined;
beforeAll(async () => {
if (cosmosEnabled()) {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
@ -243,7 +243,7 @@ describe("CosmWasmClient", () => {
});
it("can search by ID", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(posted, "value must be set in beforeAll()");
const client = new CosmWasmClient(httpUrl);
const result = await client.searchTx({ id: posted.hash });
@ -258,7 +258,7 @@ describe("CosmWasmClient", () => {
});
it("can search by ID (non existent)", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new CosmWasmClient(httpUrl);
const nonExistentId = "0000000000000000000000000000000000000000000000000000000000000000";
const result = await client.searchTx({ id: nonExistentId });
@ -266,7 +266,7 @@ describe("CosmWasmClient", () => {
});
it("can search by height", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(posted, "value must be set in beforeAll()");
const client = new CosmWasmClient(httpUrl);
const result = await client.searchTx({ height: posted.height });
@ -281,7 +281,7 @@ describe("CosmWasmClient", () => {
});
it("can search by sender", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(posted, "value must be set in beforeAll()");
const client = new CosmWasmClient(httpUrl);
const result = await client.searchTx({ sentFromOrTo: posted.sender });
@ -296,7 +296,7 @@ describe("CosmWasmClient", () => {
});
it("can search by recipient", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(posted, "value must be set in beforeAll()");
const client = new CosmWasmClient(httpUrl);
const result = await client.searchTx({ sentFromOrTo: posted.recipient });
@ -317,8 +317,8 @@ describe("CosmWasmClient", () => {
let contract: HackatomInstance | undefined;
beforeAll(async () => {
if (cosmosEnabled()) {
pendingWithoutCosmos();
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -329,7 +329,7 @@ describe("CosmWasmClient", () => {
});
it("can query existing key", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(contract);
const client = new CosmWasmClient(httpUrl);
@ -343,7 +343,7 @@ describe("CosmWasmClient", () => {
});
it("can query non-existent key", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(contract);
const client = new CosmWasmClient(httpUrl);
@ -352,7 +352,7 @@ describe("CosmWasmClient", () => {
});
it("errors for non-existent contract", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(contract);
const nonExistentAddress = makeRandomAddress();
@ -368,8 +368,8 @@ describe("CosmWasmClient", () => {
let contract: HackatomInstance | undefined;
beforeAll(async () => {
if (cosmosEnabled()) {
pendingWithoutCosmos();
if (wasmdEnabled()) {
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -380,7 +380,7 @@ describe("CosmWasmClient", () => {
});
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(contract);
const client = new CosmWasmClient(httpUrl);
@ -389,7 +389,7 @@ describe("CosmWasmClient", () => {
});
it("errors for malformed query message", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
assert(contract);
const client = new CosmWasmClient(httpUrl);
@ -400,7 +400,7 @@ describe("CosmWasmClient", () => {
});
it("errors for non-existent contract", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const nonExistentAddress = makeRandomAddress();
const client = new CosmWasmClient(httpUrl);

View File

@ -13,9 +13,11 @@ import cosmoshub from "./testdata/cosmoshub.json";
import {
getRandomizedHackatom,
makeRandomAddress,
pendingWithoutWasmd,
tendermintAddressMatcher,
tendermintIdMatcher,
tendermintOptionalIdMatcher,
wasmdEnabled,
} from "./testutils.spec";
import {
Coin,
@ -47,16 +49,6 @@ const unusedAccount = {
address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u",
};
function cosmosEnabled(): boolean {
return !!process.env.COSMOS_ENABLED;
}
function pendingWithoutCosmos(): void {
if (!cosmosEnabled()) {
return pending("Set COSMOS_ENABLED to enable Cosmos node-based tests");
}
}
function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx {
return {
msg: [firstMsg],
@ -179,7 +171,7 @@ describe("RestClient", () => {
describe("nodeInfo", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const info = await client.nodeInfo();
expect(info.node_info.network).toEqual(defaultNetworkId);
@ -188,7 +180,7 @@ describe("RestClient", () => {
describe("blocksLatest", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const response = await client.blocksLatest();
@ -221,7 +213,7 @@ describe("RestClient", () => {
describe("blocks", () => {
it("works for block by height", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const height = parseInt((await client.blocksLatest()).block.header.height, 10);
const response = await client.blocks(height - 1);
@ -255,7 +247,7 @@ describe("RestClient", () => {
describe("authAccounts", () => {
it("works for unused account without pubkey", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const { result } = await client.authAccounts(unusedAccount.address);
expect(result).toEqual({
@ -281,7 +273,7 @@ describe("RestClient", () => {
// This fails in the first test run if you forget to run `./scripts/wasmd/init.sh`
it("has correct pubkey for faucet", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const { result } = await client.authAccounts(faucet.address);
expect(result.value).toEqual(
@ -293,7 +285,7 @@ describe("RestClient", () => {
// This property is used by CosmWasmClient.getAccount
it("returns empty address for non-existent account", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
const nonExistentAccount = makeRandomAddress();
const { result } = await client.authAccounts(nonExistentAccount);
@ -306,7 +298,7 @@ describe("RestClient", () => {
describe("encodeTx", () => {
it("works for cosmoshub example", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const client = new RestClient(httpUrl);
expect(await client.encodeTx(cosmoshub.tx)).toEqual(fromBase64(cosmoshub.tx_data));
});
@ -314,7 +306,7 @@ describe("RestClient", () => {
describe("post", () => {
it("can send tokens", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const memo = "My first contract on chain";
@ -354,7 +346,7 @@ describe("RestClient", () => {
});
it("can upload, instantiate and execute wasm", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new RestClient(httpUrl);
@ -420,7 +412,7 @@ describe("RestClient", () => {
describe("query", () => {
it("can list upload code", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new RestClient(httpUrl);
@ -460,7 +452,7 @@ describe("RestClient", () => {
});
it("can list contracts and get info", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new RestClient(httpUrl);
const beneficiaryAddress = makeRandomAddress();
@ -530,7 +522,7 @@ describe("RestClient", () => {
let contractAddress: string | undefined;
beforeAll(async () => {
if (cosmosEnabled()) {
if (wasmdEnabled()) {
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const uploadResult = await uploadContract(client, pen);
assert(!uploadResult.code);
@ -545,7 +537,7 @@ describe("RestClient", () => {
});
it("can get all state", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
// get contract state
const state = await client.getAllContractState(contractAddress!);
@ -562,7 +554,7 @@ describe("RestClient", () => {
});
it("can query by key", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
// query by one key
const raw = await client.queryContractRaw(contractAddress!, expectedKey);
@ -581,7 +573,7 @@ describe("RestClient", () => {
});
it("can make smart queries", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
// we can query the verifier properly
const verifier = await client.queryContractSmart(contractAddress!, { verifier: {} });

View File

@ -3,7 +3,7 @@ import { assert } from "@iov/utils";
import { Secp256k1Pen } from "./pen";
import { RestClient } from "./restclient";
import { SigningCosmWasmClient } from "./signingcosmwasmclient";
import { getRandomizedHackatom, makeRandomAddress, pendingWithoutCosmos } from "./testutils.spec";
import { getRandomizedHackatom, makeRandomAddress, pendingWithoutWasmd } from "./testutils.spec";
import { Coin } from "./types";
const httpUrl = "http://localhost:1317";
@ -29,7 +29,7 @@ describe("SigningCosmWasmClient", () => {
describe("upload", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -39,7 +39,7 @@ describe("SigningCosmWasmClient", () => {
describe("instantiate", () => {
it("works with transfer amount", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -71,7 +71,7 @@ describe("SigningCosmWasmClient", () => {
});
it("can instantiate one code multiple times", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -90,7 +90,7 @@ describe("SigningCosmWasmClient", () => {
describe("execute", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));
const codeId = await client.upload(getRandomizedHackatom());
@ -133,7 +133,7 @@ describe("SigningCosmWasmClient", () => {
describe("sendTokens", () => {
it("works", async () => {
pendingWithoutCosmos();
pendingWithoutWasmd();
const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic);
const client = new SigningCosmWasmClient(httpUrl, faucet.address, signBytes => pen.sign(signBytes));

View File

@ -58,13 +58,13 @@ export const tendermintIdMatcher = /^[0-9A-F]{64}$/;
export const tendermintOptionalIdMatcher = /^([0-9A-F]{64}|)$/;
export const tendermintAddressMatcher = /^[0-9A-F]{40}$/;
export function cosmosEnabled(): boolean {
return !!process.env.COSMOS_ENABLED;
export function wasmdEnabled(): boolean {
return !!process.env.WASMD_ENABLED;
}
export function pendingWithoutCosmos(): void {
if (!cosmosEnabled()) {
return pending("Set COSMOS_ENABLED to enable Cosmos node-based tests");
export function pendingWithoutWasmd(): void {
if (!wasmdEnabled()) {
return pending("Set WASMD_ENABLED to enable Wasmd based tests");
}
}

View File

@ -14,6 +14,6 @@ module.exports = [
path: distdir,
filename: "tests.js",
},
plugins: [new webpack.EnvironmentPlugin(["COSMOS_ENABLED"])],
plugins: [new webpack.EnvironmentPlugin(["WASMD_ENABLED"])],
},
];