Skip to content

Commit 158b901

Browse files
authored
Deflake Core dashboard test (#52558)
The dashboard tests are supposed to mock out API responses anyways, this test did not mock out one of API calls. We'll mock it out and this should deflake this test. Signed-off-by: Alan Guo <aguo@anyscale.com>
1 parent 7beea56 commit 158b901

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

python/ray/dashboard/client/src/pages/overview/OverviewPage.component.test.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,22 @@ import React, { PropsWithChildren } from "react";
33
import { MemoryRouter } from "react-router-dom";
44
import { GlobalContext } from "../../App";
55
import { STYLE_WRAPPER } from "../../util/test-utils";
6+
import { useRayStatus } from "../job/hook/useClusterStatus";
67
import { useJobList } from "../job/hook/useJobList";
78
import { OverviewPage } from "./OverviewPage";
89

910
jest.mock("../job/hook/useJobList");
11+
jest.mock("../job/hook/useClusterStatus");
12+
13+
const mockedUseRayStatus = jest.mocked(useRayStatus);
1014

1115
describe("OverviewPage", () => {
16+
beforeEach(() => {
17+
mockedUseRayStatus.mockReturnValue({
18+
clusterStatus: undefined,
19+
});
20+
});
21+
1222
it("renders", async () => {
1323
expect.assertions(3);
1424

0 commit comments

Comments
 (0)