Skip to content

Commit

Permalink
Fix PR test failures
Browse files Browse the repository at this point in the history
Signed-off-by: Sandeep Kumawat <[email protected]>
  • Loading branch information
Sandeep Kumawat committed Aug 16, 2024
1 parent e882052 commit 2e4ab6b
Show file tree
Hide file tree
Showing 9 changed files with 153 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ import { ServicesContext } from "../../../../services";
import { browserServicesMock, coreServicesMock, apiCallerMock } from "../../../../../test/mocks";
import { ROUTES } from "../../../../utils/constants";
import { CoreServicesContext } from "../../../../components/core_services";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderCreateDataStreamWithRouter(initialEntries = [ROUTES.DATA_STREAMS] as string[]) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,23 @@ import { CoreServicesContext } from "../../../../components/core_services";
import { HashRouter, Route } from "react-router-dom";
import { ROUTES } from "../../../../utils/constants";
import userEvent from "@testing-library/user-event";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderCreateDataStream(props: Omit<DataStreamDetailProps, "history">) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ import { BREADCRUMBS, ROUTES } from "../../../../utils/constants";
import CreateRollupForm from "./CreateRollupForm";
import { CoreServicesContext } from "../../../../components/core_services";
import { DataStream } from "../../../../../server/models/interfaces";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

const sampleMapping = {
index_1: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ import { CoreServicesContext } from "../../../../components/core_services";
import userEvent from "@testing-library/user-event";
import { DataStreamStats, DataStreamWithStats } from "../../interface";
import { DataStream } from "../../../../../server/models/interfaces";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderWithRouter() {
return {
Expand Down
17 changes: 17 additions & 0 deletions public/pages/EditRollup/containers/EditRollup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ import { BrowserServices } from "../../../models/interfaces";
import { BREADCRUMBS, ROUTES } from "../../../utils/constants";
import { testRollup } from "../../../../test/constants";
import { CoreServicesContext } from "../../../components/core_services";
import { getApplication, getNavigationUI, getUISettings } from "../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderEditRollupWithRouter(initialEntries = ["/"]) {
return {
Expand Down
17 changes: 17 additions & 0 deletions public/pages/ForceMerge/container/ForceMerge/ForceMerge.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ import { CoreServicesConsumer, CoreServicesContext } from "../../../../component
import ForceMerge from "./ForceMerge";
import { ModalProvider, ModalRoot } from "../../../../components/Modal";
import { BrowserServices } from "../../../../models/interfaces";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderWithRouter(initialEntries = [ROUTES.FORCE_MERGE] as string[]) {
return {
Expand Down
17 changes: 17 additions & 0 deletions public/pages/Rollover/containers/Rollover/Rollover.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,23 @@ import Rollover, { RolloverProps } from "./Rollover";
import { ModalProvider } from "../../../../components/Modal";
import { ServicesContext } from "../../../../services";
import { CoreServicesContext } from "../../../../components/core_services";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderWithRouter(props: Omit<RolloverProps, keyof RouteComponentProps>, initialEntries: string[]) {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,23 @@ import RollupDetails from "./RollupDetails";
import { ServicesConsumer, ServicesContext } from "../../../../services";
import { testRollup, testRollup2 } from "../../../../../test/constants";
import { CoreServicesContext } from "../../../../components/core_services";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderRollupDetailsWithRouter(initialEntries = ["/"]) {
return {
Expand Down
17 changes: 17 additions & 0 deletions public/pages/Rollups/containers/Rollups/Rollups.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ import Rollups from "./Rollups";
import { TEXT } from "../../components/RollupEmptyPrompt/RollupEmptyPrompt";
import { testRollup } from "../../../../../test/constants";
import { CoreServicesContext } from "../../../../components/core_services";
import { getApplication, getNavigationUI, getUISettings } from "../../../../services/Services";

jest.mock("../../../../services/Services", () => ({
...jest.requireActual("../../../../services/Services"),
getUISettings: jest.fn(),
getApplication: jest.fn(),
getNavigationUI: jest.fn(),
}));

beforeEach(() => {
(getUISettings as jest.Mock).mockReturnValue({
get: jest.fn().mockReturnValue(false), // or false, depending on your test case
});
(getApplication as jest.Mock).mockReturnValue({});

(getNavigationUI as jest.Mock).mockReturnValue({});
});

function renderRollupsWithRouter() {
return {
Expand Down

0 comments on commit 2e4ab6b

Please sign in to comment.