Skip to content

Commit

Permalink
web-wallet: Refactor redirect tests
Browse files Browse the repository at this point in the history
Resolves #2193
  • Loading branch information
nortonandreev committed Aug 22, 2024
1 parent a38b396 commit 8490895
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web-wallet/src/lib/navigation/__tests__/redirect.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ describe("redirect", () => {
});

it("should add the defined base path to SvelteKit's `redirect` calls for absolute paths", () => {
expect.assertions(3);

redirect(300, "/");
redirect(301, "/foo/path");

Expand All @@ -26,7 +28,9 @@ describe("redirect", () => {
expect(redirectMock).toHaveBeenNthCalledWith(2, 301, `${base}/foo/path`);
});

it("should add nothing for relative paths and complete string URLs", async () => {
it("should add nothing for relative paths and complete string URLs", () => {
expect.assertions(3);

redirect(300, "foo/bar");
redirect(300, "http://example.com/");

Expand All @@ -35,7 +39,9 @@ describe("redirect", () => {
expect(redirectMock).toHaveBeenNthCalledWith(2, 300, "http://example.com/");
});

it("should do nothing if the received path is an URL object", async () => {
it("should do nothing if the received path is an URL object", () => {
expect.assertions(2);

const url = new URL("http://www.example.com/");

redirect(300, url);
Expand Down

0 comments on commit 8490895

Please sign in to comment.