Skip to content

Commit 1c63e78

Browse files
committed
broken test fix
1 parent 607b85d commit 1c63e78

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

thirdeye-ui/src/app/routers/alerts/alerts.router.test.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { MemoryRouter, Route, Routes } from "react-router-dom";
1818
import { AppLoadingIndicatorV1 } from "../../platform/components/app-loading-indicator-v1/app-loading-indicator-v1.component";
1919
import { AppRoute, AppRouteRelative } from "../../utils/routes/routes.util";
2020
import { AlertsRouter } from "./alerts.router";
21+
import axios from "axios";
2122

2223
jest.mock("react-i18next", () => ({
2324
useTranslation: jest.fn().mockReturnValue({
@@ -133,6 +134,9 @@ describe("Alerts Router", () => {
133134
});
134135

135136
it("should render alerts view page at exact alerts view path", async () => {
137+
jest.spyOn(axios, "get").mockResolvedValueOnce({
138+
data: {},
139+
});
136140
render(
137141
<MemoryRouter initialEntries={[`/alerts/1234`]}>
138142
<Routes>

thirdeye-ui/src/app/utils/routes/alert-fetch-redirect-params/alert-fetch-redirect-params.test.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ jest.mock(
4848

4949
describe("Alert Fetch Redirect Params", () => {
5050
it("should have called navigate with the time range values in query string returned from API request", async () => {
51+
jest.spyOn(axios, "get").mockResolvedValueOnce({
52+
data: {},
53+
});
5154
jest.spyOn(axios, "post").mockResolvedValueOnce({
5255
data: {
5356
defaultStartTime: 10,
@@ -72,6 +75,9 @@ describe("Alert Fetch Redirect Params", () => {
7275
});
7376

7477
it("should have called navigate with the time range values from fallbackDurationGenerator in query string is API request fails", async () => {
78+
jest.spyOn(axios, "get").mockResolvedValueOnce({
79+
data: {},
80+
});
7581
jest.spyOn(axios, "post").mockRejectedValueOnce({
7682
data: {},
7783
});
@@ -93,7 +99,10 @@ describe("Alert Fetch Redirect Params", () => {
9399
});
94100

95101
it("should have called navigate with the time range values in query string if there are no last used paths for key", async () => {
96-
jest.spyOn(axios, "get").mockRejectedValueOnce({
102+
jest.spyOn(axios, "get").mockResolvedValueOnce({
103+
data: {},
104+
});
105+
jest.spyOn(axios, "post").mockRejectedValue({
97106
data: {},
98107
});
99108
mockGetLastUsedForPath.mockReturnValue(undefined);

0 commit comments

Comments
 (0)