Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 5ff7662

Browse files
committed
Fix QuickThemeSwitcher-test.tsx
1 parent 183c7b9 commit 5ff7662

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

test/components/views/spaces/QuickThemeSwitcher-test.tsx

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,17 @@ import { mocked } from "jest-mock";
2121

2222
import QuickThemeSwitcher from "../../../../src/components/views/spaces/QuickThemeSwitcher";
2323
import { getOrderedThemes } from "../../../../src/theme";
24-
import ThemeChoicePanel from "../../../../src/components/views/settings/ThemeChoicePanel";
2524
import SettingsStore from "../../../../src/settings/SettingsStore";
2625
import { SettingLevel } from "../../../../src/settings/SettingLevel";
2726
import dis from "../../../../src/dispatcher/dispatcher";
2827
import { Action } from "../../../../src/dispatcher/actions";
2928
import { mockPlatformPeg } from "../../../test-utils/platform";
29+
import { useTheme } from "../../../../src/hooks/useTheme";
3030

31-
jest.mock("../../../../src/theme");
32-
jest.mock("../../../../src/components/views/settings/ThemeChoicePanel", () => ({
33-
calculateThemeState: jest.fn(),
31+
jest.mock("../../../../src/hooks/useTheme", () => ({
32+
useTheme: jest.fn(),
3433
}));
34+
jest.mock("../../../../src/theme");
3535
jest.mock("../../../../src/settings/SettingsStore", () => ({
3636
setValue: jest.fn(),
3737
getValue: jest.fn(),
@@ -59,9 +59,10 @@ describe("<QuickThemeSwitcher />", () => {
5959
{ id: "light", name: "Light" },
6060
{ id: "dark", name: "Dark" },
6161
]);
62-
mocked(ThemeChoicePanel).calculateThemeState.mockClear().mockReturnValue({
62+
63+
mocked(useTheme).mockClear().mockReturnValue({
6364
theme: "light",
64-
useSystemTheme: false,
65+
systemThemeActivated: false,
6566
});
6667
mocked(SettingsStore).setValue.mockClear().mockResolvedValue();
6768
mocked(dis).dispatch.mockClear();
@@ -85,9 +86,9 @@ describe("<QuickThemeSwitcher />", () => {
8586
});
8687

8788
it("renders dropdown correctly when use system theme is truthy", () => {
88-
mocked(ThemeChoicePanel).calculateThemeState.mockClear().mockReturnValue({
89+
mocked(useTheme).mockClear().mockReturnValue({
8990
theme: "light",
90-
useSystemTheme: true,
91+
systemThemeActivated: true,
9192
});
9293
renderComponent();
9394
expect(screen.getByText("Match system")).toBeInTheDocument();

0 commit comments

Comments
 (0)