Skip to content

Commit

Permalink
Add another test for handling base url without trailing slash
Browse files Browse the repository at this point in the history
  • Loading branch information
yuvipanda committed Oct 13, 2023
1 parent 50212c1 commit 75127e6
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions js/packages/binderhub-client/tests/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,26 @@ test("Get full redirect URL and deal with excessive slashes (with pathType=lab)"
);
});

test("Get full redirect URL and deal with missing trailing slash", () => {
const br = new BinderRepository(
"gh/test/test",
new URL("https://test-binder.org/build"),
);
expect(
br
.getFullRedirectURL(
// Missing trailing slash here should not affect target url
"https://hub.test-binder.org/user/something",
"token",
"/directory/index.ipynb/",
"lab",
)
.toString(),
).toBe(
"https://hub.test-binder.org/user/something/doc/tree/directory/index.ipynb?token=token",
);
});

test("Get full redirect URL and deal with excessive slashes (with pathType=file)", () => {
const br = new BinderRepository(
"gh/test/test",
Expand Down

0 comments on commit 75127e6

Please sign in to comment.