Skip to content

Commit

Permalink
Mock useIsAutoDetectSchemaChangesEnabled hook in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundito committed Dec 5, 2022
1 parent c18594b commit fa1b17e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,18 +20,14 @@ jest.doMock("views/Connection/ConnectionForm/components/refreshSourceSchemaWithC
useRefreshSourceSchemaWithConfirmationOnDirty: mockUseRefreshSourceSchemaWithConfirmationOnDirty,
}));

jest.mock("hooks/connection/useIsAutoDetectSchemaChangesEnabled", () => ({
useIsAutoDetectSchemaChangesEnabled: () => true,
}));

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { SchemaChangesDetected } = require("./SchemaChangesDetected");

describe("<SchemaChangesDetected />", () => {
beforeAll(() => {
process.env.REACT_APP_AUTO_DETECT_SCHEMA_CHANGES = "true";
});

afterAll(() => {
delete process.env.REACT_APP_AUTO_DETECT_SCHEMA_CHANGES;
});

beforeEach(() => {
mockUseConnectionEditService.mockReturnValue({
connection: mockConnection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,14 @@ jest.doMock("views/Connection/ConnectionForm/components/refreshSourceSchemaWithC
useRefreshSourceSchemaWithConfirmationOnDirty: jest.fn(),
}));

jest.mock("hooks/connection/useIsAutoDetectSchemaChangesEnabled", () => ({
useIsAutoDetectSchemaChangesEnabled: () => true,
}));

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { StatusMainInfo } = require("./StatusMainInfo");

describe("<StatusMainInfo />", () => {
beforeAll(() => {
process.env.REACT_APP_AUTO_DETECT_SCHEMA_CHANGES = "true";
});

afterAll(() => {
delete process.env.REACT_APP_AUTO_DETECT_SCHEMA_CHANGES;
});

beforeEach(() => {
mockUseConnectionEditService.mockReturnValue({
connection: mockConnection,
Expand Down

0 comments on commit fa1b17e

Please sign in to comment.