Skip to content

Commit

Permalink
🌱 Fix logged 404 errors from axios-mock-adapter (konveyor#1847)
Browse files Browse the repository at this point in the history
Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com>
  • Loading branch information
rszwajko committed Apr 15, 2024
1 parent 9dc6433 commit 655b493
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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(
<ApplicationFormModal application={null} onClose={mockChangeValue} />
Expand Down Expand Up @@ -121,5 +114,5 @@ describe("Component: application-form", () => {
);

expect(createButton).toBeEnabled();
});
}, 10000);
});

0 comments on commit 655b493

Please sign in to comment.