mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-16 14:33:00 +00:00
fix spawn page link
This commit is contained in:
@@ -30,7 +30,7 @@ const AccessServerButton = ({ url }) => (
|
||||
);
|
||||
|
||||
const ServerDashboard = (props) => {
|
||||
let base_url = window.base_url;
|
||||
let base_url = window.base_url || "/";
|
||||
// sort methods
|
||||
var usernameDesc = (e) => e.sort((a, b) => (a.name > b.name ? 1 : -1)),
|
||||
usernameAsc = (e) => e.sort((a, b) => (a.name < b.name ? 1 : -1)),
|
||||
@@ -277,7 +277,7 @@ const ServerDashboard = (props) => {
|
||||
/>
|
||||
<a
|
||||
href={`${base_url}spawn/${user.name}${
|
||||
server.name && "/" + server.name
|
||||
server.name ? "/" + server.name : ""
|
||||
}`}
|
||||
>
|
||||
<button
|
||||
|
@@ -98,6 +98,18 @@ test("Renders correctly the status of a single-user server", async () => {
|
||||
expect(stop).toBeVisible();
|
||||
});
|
||||
|
||||
test("Renders spawn page link", async () => {
|
||||
let callbackSpy = mockAsync();
|
||||
|
||||
await act(async () => {
|
||||
render(serverDashboardJsx(callbackSpy));
|
||||
});
|
||||
|
||||
let link = screen.getByText("Spawn Page").closest("a");
|
||||
let url = new URL(link.href);
|
||||
expect(url.pathname).toEqual("/spawn/bar");
|
||||
});
|
||||
|
||||
test("Invokes the startServer event on button click", async () => {
|
||||
let callbackSpy = mockAsync();
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
export const jhapiRequest = (endpoint, method, data) => {
|
||||
let base_url = window.base_url,
|
||||
let base_url = window.base_url || "/",
|
||||
api_url = `${base_url}hub/api`;
|
||||
return fetch(api_url + endpoint, {
|
||||
method: method,
|
||||
|
Reference in New Issue
Block a user