From 41e2b64964a1b13e7bea067f8d3865b82165f87a Mon Sep 17 00:00:00 2001 From: "konveyor-ci-bot[bot]" <159171263+konveyor-ci-bot[bot]@users.noreply.github.com> Date: Mon, 15 Apr 2024 18:16:33 -0400 Subject: [PATCH] :seedling: Fix logged 404 errors from axios-mock-adapter (#1847) (#1852) Backport-of: #1847 Signed-off-by: Radoslaw Szwajkowski Signed-off-by: Cherry Picker --- .../__tests__/analysis-wizard.test.tsx | 2 ++ .../__tests__/application-form.test.tsx | 21 +++++++------------ 2 files changed, 9 insertions(+), 14 deletions(-) diff --git a/client/src/app/pages/applications/analysis-wizard/__tests__/analysis-wizard.test.tsx b/client/src/app/pages/applications/analysis-wizard/__tests__/analysis-wizard.test.tsx index e04108317..b8f3b10a3 100644 --- a/client/src/app/pages/applications/analysis-wizard/__tests__/analysis-wizard.test.tsx +++ b/client/src/app/pages/applications/analysis-wizard/__tests__/analysis-wizard.test.tsx @@ -6,6 +6,8 @@ import { TASKGROUPS } from "@app/api/rest"; import mock from "@app/test-config/mockInstance"; import userEvent from "@testing-library/user-event"; +mock.onAny().reply(200, []); + const applicationData1 = { id: 1, name: "App1", diff --git a/client/src/app/pages/applications/components/application-form/__tests__/application-form.test.tsx b/client/src/app/pages/applications/components/application-form/__tests__/application-form.test.tsx index 8bddc1753..082371c77 100644 --- a/client/src/app/pages/applications/components/application-form/__tests__/application-form.test.tsx +++ b/client/src/app/pages/applications/components/application-form/__tests__/application-form.test.tsx @@ -6,12 +6,7 @@ import { fireEvent, } from "@app/test-config/test-utils"; -import { - APPLICATIONS, - BUSINESS_SERVICES, - REVIEWS, - TAG_CATEGORIES, -} from "@app/api/rest"; +import { BUSINESS_SERVICES } from "@app/api/rest"; import mock from "@app/test-config/mockInstance"; import userEvent from "@testing-library/user-event"; @@ -20,19 +15,17 @@ import "@testing-library/jest-dom"; import { BusinessService } from "@app/api/models"; import { ApplicationFormModal } from "../application-form-modal"; -const data: any[] = []; -mock.onGet(`${BUSINESS_SERVICES}`).reply(200, data); -mock.onGet(`${TAG_CATEGORIES}`).reply(200, data); -mock.onGet(`${APPLICATIONS}`).reply(200, data); -mock.onGet(`${REVIEWS}`).reply(200, data); - describe("Component: application-form", () => { const mockChangeValue = jest.fn(); it("Validation tests", async () => { const businessServices: BusinessService[] = [{ id: 1, name: "service" }]; - mock.onGet(`${BUSINESS_SERVICES}`).reply(200, businessServices); + mock + .onGet(`${BUSINESS_SERVICES}`) + .reply(200, businessServices) + .onAny() + .reply(200, []); render( @@ -121,5 +114,5 @@ describe("Component: application-form", () => { ); expect(createButton).toBeEnabled(); - }); + }, 10000); });