Skip to content

Commit

Permalink
Merge pull request #2759 from dusk-network/feature-2758-add-staging-url
Browse files Browse the repository at this point in the history
explorer: Add staging URL into node URL function
  • Loading branch information
kieranhall authored Oct 24, 2024
2 parents 2a44135 + 82f6092 commit d522ae6
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 d522ae6

Please sign in to comment.