Skip to content

Commit

Permalink
Organizing mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
laisspportugal committed Dec 16, 2024
1 parent 8b5ad48 commit b4626bf
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions packages/suite-base/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/

import { render, screen } from "@testing-library/react";
import React from "react";

import { IAppConfiguration } from "@lichtblick/suite-base/context/AppConfigurationContext";

Expand All @@ -17,37 +18,18 @@ beforeEach(() => {
jest.clearAllMocks();
});

// Mocking shared providers
jest.mock("./providers/LayoutManagerProvider", () => jest.fn(() => <></>));
jest.mock("./providers/PanelCatalogProvider", () =>
jest.fn(({ children }) => <div data-testid="panel-catalog-provider">{children}</div>),
);
// Mocking shared components
jest.mock("./components/MultiProvider", () =>
jest.fn(({ children }) => <div data-testid="multi-provider">{children}</div>),
);
jest.mock("./components/GlobalCss", () =>
jest.fn(({ children }) => <div data-testid="global-css">{children}</div>),
);
jest.mock("./components/StudioToastProvider", () => jest.fn(() => <></>));
jest.mock("./components/DocumentTitleAdapter", () =>
jest.fn(({ children }) => <div data-testid="document-title-adapter">{children}</div>),
);
jest.mock("./components/ErrorBoundary", () =>
jest.fn(({ children }) => <div data-testid="error-boundary">{children}</div>),
);
// Mocking shared providers and components
jest.mock("./providers/LayoutManagerProvider", () => jest.fn(({ children }) => <div data-testid="layout-manager-provider">{children}</div>));

Check failure on line 22 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="layout-manager-provider">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="layout-manager-provider">{children}</div>),⏎`
jest.mock("./providers/PanelCatalogProvider", () => jest.fn(({ children }) => <div data-testid="panel-catalog-provider">{children}</div>));

Check failure on line 23 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="panel-catalog-provider">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="panel-catalog-provider">{children}</div>),⏎`
jest.mock("./components/MultiProvider", () => jest.fn(({ children }) => <div data-testid="multi-provider">{children}</div>));

Check failure on line 24 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="multi-provider">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="multi-provider">{children}</div>),⏎`
jest.mock("./components/GlobalCss", () => jest.fn(({ children }) => <div data-testid="global-css">{children}</div>));

Check failure on line 25 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="global-css">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="global-css">{children}</div>),⏎`
jest.mock("./components/DocumentTitleAdapter", () => jest.fn(({ children }) => <div data-testid="document-title-adapter">{children}</div>));

Check failure on line 26 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="document-title-adapter">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="document-title-adapter">{children}</div>),⏎`
jest.mock("./components/ErrorBoundary", () => jest.fn(({ children }) => <div data-testid="error-boundary">{children}</div>));

Check failure on line 27 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="error-boundary">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="error-boundary">{children}</div>),⏎`
jest.mock("./components/ColorSchemeThemeProvider", () => ({
ColorSchemeThemeProvider: jest.fn(({ children }) => (
<div data-testid="color-scheme-theme">{children}</div>
)),
ColorSchemeThemeProvider: jest.fn(({ children }) => <div data-testid="color-scheme-theme">{children}</div>),

Check failure on line 29 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `<div·data-testid="color-scheme-theme">{children}</div>` with `(⏎····<div·data-testid="color-scheme-theme">{children}</div>⏎··)`
}));
jest.mock("./components/CssBaseline", () =>
jest.fn(({ children }) => <div data-testid="css-baseline"> {children}</div>),
);
jest.mock("./components/SendNotificationToastAdapter", () =>
jest.fn(({ children }) => <div data-testid="send-notification-toast-adapter">{children}</div>),
);

jest.mock("./components/CssBaseline", () => jest.fn(({ children }) => <div data-testid="css-baseline">{children}</div>));

Check failure on line 31 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="css-baseline">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="css-baseline">{children}</div>),⏎`
jest.mock("./components/SendNotificationToastAdapter", () => jest.fn(({ children }) => <div data-testid="send-notification-toast-adapter">{children}</div>));

Check failure on line 32 in packages/suite-base/src/App.test.tsx

View workflow job for this annotation

GitHub Actions / lint (ubuntu-20.04)

Replace `·jest.fn(({·children·})·=>·<div·data-testid="send-notification-toast-adapter">{children}</div>)` with `⏎··jest.fn(({·children·})·=>·<div·data-testid="send-notification-toast-adapter">{children}</div>),⏎`
jest.mock("./context/NativeAppMenuContext", () => ({
Provider: jest.fn(({ children }) => <div data-testid="native-app-component">{children}</div>),
}));
Expand Down

0 comments on commit b4626bf

Please sign in to comment.