Skip to content

Commit

Permalink
Add more tests for getExplorerLink()
Browse files Browse the repository at this point in the history
  • Loading branch information
mikemaccana committed May 24, 2024
1 parent f3bc3e8 commit f76d0cd
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,11 @@ describe("getExplorerLink", () => {
assert.equal(link, "https://explorer.solana.com/block/242233124");
});

test("getExplorerLink works for a block on mainnet when no network is supplied", () => {
const link = getExplorerLink("block", "242233124");
assert.equal(link, "https://explorer.solana.com/block/242233124");
});

test("getExplorerLink works for an address on mainnet", () => {
const link = getExplorerLink(
"address",
Expand Down Expand Up @@ -361,6 +366,18 @@ describe("getExplorerLink", () => {
const link = getExplorerLink("block", "241889720", "mainnet-beta");
assert.equal(link, "https://explorer.solana.com/block/241889720");
});

test("getExplorerLink provides a localnet URL", () => {
const link = getExplorerLink(
"tx",
"2QC8BkDVZgaPHUXG9HuPw7aE5d6kN5DTRXLe2inT1NzurkYTCFhraSEo883CPNe18BZ2peJC1x1nojZ5Jmhs94pL",
"localnet",
);
assert.equal(
link,
"https://explorer.solana.com/tx/2QC8BkDVZgaPHUXG9HuPw7aE5d6kN5DTRXLe2inT1NzurkYTCFhraSEo883CPNe18BZ2peJC1x1nojZ5Jmhs94pL?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899",
);
});
});

describe("makeKeypairs", () => {
Expand Down

0 comments on commit f76d0cd

Please sign in to comment.