From 633618cfcb3ca4b5cb7d354e7df6c6d51162b03d Mon Sep 17 00:00:00 2001 From: sumn2u Date: Tue, 23 Jul 2024 17:23:29 -0500 Subject: [PATCH] fix regions failing test --- client/src/RegionLabel/RegionLabel.test.js | 8 ++++++++ client/src/RegionTags/RegionTags.test.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/client/src/RegionLabel/RegionLabel.test.js b/client/src/RegionLabel/RegionLabel.test.js index db10971..2f42d08 100644 --- a/client/src/RegionLabel/RegionLabel.test.js +++ b/client/src/RegionLabel/RegionLabel.test.js @@ -15,6 +15,14 @@ const renderComponent = (props) => { ) } +// Mock the useTheme hook +jest.mock('../ThemeContext', () => ({ + useTheme: () => ({ + theme: 'light', // Provide mock theme + toggleTheme: jest.fn(), // Mock function + }), +})); + // Mock the useTranslation hook jest.mock("react-i18next", () => ({ useTranslation: () => ({ diff --git a/client/src/RegionTags/RegionTags.test.js b/client/src/RegionTags/RegionTags.test.js index 90c8d00..ab97b06 100644 --- a/client/src/RegionTags/RegionTags.test.js +++ b/client/src/RegionTags/RegionTags.test.js @@ -38,6 +38,14 @@ jest.mock("react-i18next", () => ({ }), })) +// Mock the useTheme hook +jest.mock('../ThemeContext', () => ({ + useTheme: () => ({ + theme: 'light', // Provide mock theme + toggleTheme: jest.fn(), // Mock function + }), +})); + describe("RegionTags component", () => { it("renders correctly for different region conditions", () => { const regions = [