Skip to content

Commit

Permalink
explorer: Add staging URL into node URL function
Browse files Browse the repository at this point in the history
  • Loading branch information
kieranhall committed Oct 24, 2024
1 parent 376c9c0 commit 82f6092
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
16 changes: 16 additions & 0 deletions explorer/src/lib/url/__tests__/makeNodeUrl.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,20 @@ describe("makeNodeUrl", () => {

expect(makeNodeUrl().hostname).toBe("nodes.dusk.network");
});

it("should return the mainnet URL when the hostname starts with 'staging.apps'", () => {
global.window = Object.create(window);

const url = new URL("https://staging.apps.dusk.network");

Object.defineProperty(window, "location", {
value: {
hostname: url.hostname,
href: url.href,
protocol: url.protocol,
},
});

expect(makeNodeUrl().hostname).toBe("nodes.dusk.network");
});
});
1 change: 1 addition & 0 deletions explorer/src/lib/url/makeNodeUrl.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ function makeNodeUrl(path = "") {

switch (subDomains[0]) {
case "apps": // mainnet
case "staging": // mainnet staging
nodeUrl = buildHostedNodeUrl("nodes.");
break;
case "devnet":
Expand Down

0 comments on commit 82f6092

Please sign in to comment.