mirror of
https://github.com/jupyterhub/jupyterhub.git
synced 2025-10-12 12:33:02 +00:00
Fix tests
This commit is contained in:
@@ -216,7 +216,7 @@ const ServerDashboard = (props) => {
|
|||||||
dataTarget={`#${user.name}-${server.name}-collapse`}
|
dataTarget={`#${user.name}-${server.name}-collapse`}
|
||||||
/>{" "}
|
/>{" "}
|
||||||
</span>
|
</span>
|
||||||
{user.name}
|
<div data-testid={`user-name-div-${user.name}`}>{user.name}</div>
|
||||||
</td>
|
</td>
|
||||||
<td data-testid="user-row-admin">{user.admin ? "admin" : ""}</td>
|
<td data-testid="user-row-admin">{user.admin ? "admin" : ""}</td>
|
||||||
|
|
||||||
|
@@ -76,8 +76,8 @@ test("Renders users from props.user_data into table", async () => {
|
|||||||
render(serverDashboardJsx(callbackSpy));
|
render(serverDashboardJsx(callbackSpy));
|
||||||
});
|
});
|
||||||
|
|
||||||
let foo = screen.getByText("foo");
|
let foo = screen.getByTestId("user-name-div-foo");
|
||||||
let bar = screen.getByText("bar");
|
let bar = screen.getByTestId("user-name-div-bar");
|
||||||
|
|
||||||
expect(foo).toBeVisible();
|
expect(foo).toBeVisible();
|
||||||
expect(bar).toBeVisible();
|
expect(bar).toBeVisible();
|
||||||
@@ -156,12 +156,12 @@ test("Sorts according to username", async () => {
|
|||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
let first = screen.getAllByTestId("user-row-name")[0];
|
let first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("bar");
|
expect(first.textContent).toContain("bar");
|
||||||
|
|
||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
first = screen.getAllByTestId("user-row-name")[0];
|
first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("foo");
|
expect(first.textContent).toContain("foo");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Sorts according to admin", async () => {
|
test("Sorts according to admin", async () => {
|
||||||
@@ -194,12 +194,12 @@ test("Sorts according to last activity", async () => {
|
|||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
let first = screen.getAllByTestId("user-row-name")[0];
|
let first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("foo");
|
expect(first.textContent).toContain("foo");
|
||||||
|
|
||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
first = screen.getAllByTestId("user-row-name")[0];
|
first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("bar");
|
expect(first.textContent).toContain("bar");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Sorts according to server status (running/not running)", async () => {
|
test("Sorts according to server status (running/not running)", async () => {
|
||||||
@@ -213,12 +213,12 @@ test("Sorts according to server status (running/not running)", async () => {
|
|||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
let first = screen.getAllByTestId("user-row-name")[0];
|
let first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("foo");
|
expect(first.textContent).toContain("foo");
|
||||||
|
|
||||||
fireEvent.click(handler);
|
fireEvent.click(handler);
|
||||||
|
|
||||||
first = screen.getAllByTestId("user-row-name")[0];
|
first = screen.getAllByTestId("user-row-name")[0];
|
||||||
expect(first.textContent).toBe("bar");
|
expect(first.textContent).toContain("bar");
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Renders nothing if required data is not available", async () => {
|
test("Renders nothing if required data is not available", async () => {
|
||||||
|
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user