Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
Adjust some tests and add a new one
Browse files Browse the repository at this point in the history
  • Loading branch information
eggplantzzz committed Nov 4, 2021
1 parent fb18c0b commit 9fe5bc3
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions packages/hdwallet-provider/test/urlValidation.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import assert from "assert";
import WalletProvider from "../dist";
import Ganache from "ganache-core";
import { describe, it } from "mocha";

const { isValidProvider } = WalletProvider;
Expand All @@ -20,8 +21,8 @@ describe("HD Wallet Provider Validator", () => {
assert.fail("did not throw!");
} catch (e) {
const expectedMessage = [
`Malformed provider URL: '${badUrl}'`,
"Please specify a correct URL, using the http, https, ws, or wss protocol.",
`No provider or an invalid provider was specified: '${badUrl}'`,
"Please specify a valid provider or URL, using the http, https, ws, or wss protocol.",
""
].join("\n");
assert.equal(e.message, expectedMessage);
Expand All @@ -35,8 +36,8 @@ describe("HD Wallet Provider Validator", () => {
assert.fail("did not throw!");
} catch (e) {
const expectedMessage = [
`Malformed provider URL: '${badUrl}'`,
"Please specify a correct URL, using the http, https, ws, or wss protocol.",
`No provider or an invalid provider was specified: '${badUrl}'`,
"Please specify a valid provider or URL, using the http, https, ws, or wss protocol.",
""
].join("\n");
assert.equal(e.message, expectedMessage);
Expand Down Expand Up @@ -80,5 +81,13 @@ describe("HD Wallet Provider Validator", () => {
"Good WSS Url should pass validation"
);
});

it("a provider", () => {
const provider = Ganache.provider();
assert.ok(
isValidProvider(provider),
"Good provider should pass validation."
);
});
});
});

0 comments on commit 9fe5bc3

Please sign in to comment.