Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test[faucet-client ]: add unit test and remove unused import #1533

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions packages/cli/examples/local_faucet.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { StdFee, SigningStargateClient } from "@cosmjs/stargate";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { MsgSend } from "cosmjs-types/cosmos/bank/v1beta1/tx";
import { coins } from "@cosmjs/amino";
import { Random } from "@cosmjs/crypto";

const defaultHttpUrl = "http://localhost:26658";
const defaultFee: StdFee = {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/examples/tendermint0.37.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { coins, makeCosmoshubPath } from "@cosmjs/amino";
import { coins } from "@cosmjs/amino";
import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { assertIsDeliverTxSuccess, calculateFee, GasPrice, SigningStargateClient } from "@cosmjs/stargate";
import { assertIsDeliverTxSuccess, GasPrice, SigningStargateClient } from "@cosmjs/stargate";
import { Tendermint37Client } from "@cosmjs/tendermint-rpc";

// Network config
Expand Down
6 changes: 6 additions & 0 deletions packages/faucet-client/src/faucetclient.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ describe("FaucetClient", () => {
expect(new FaucetClient("https://localhost/")).toBeTruthy();
});

it("should throw error if the base URL does not start with http:// or https://", () => {
expect(() => new FaucetClient("ftp://example.com")).toThrowError(
"Expected base url to start with http:// or https://",
);
});

it("can be used to credit a wallet", async () => {
pendingWithoutFaucet();
const faucet = new FaucetClient(faucetUrl);
Expand Down
2 changes: 1 addition & 1 deletion packages/stream/src/valueandupdates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export type SearchFunction<T> = (value: T) => boolean;
/**
* A read only wrapper around DefaultValueProducer that allows
* to synchronously get the current value using the .value property
* and listen to to updates by suscribing to the .updates stream
* and listen to updates by subscribing to the .updates stream
*/
export class ValueAndUpdates<T> {
public readonly updates: MemoryStream<T>;
Expand Down