Skip to content

Commit 6314341

Browse files
committed
test
1 parent 0b4dc8d commit 6314341

File tree

3 files changed

+20
-7
lines changed

3 files changed

+20
-7
lines changed

site/src/components/Badges/Badges.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { PropsWithChildren, FC } from "react";
22
import Tooltip from "@mui/material/Tooltip";
33
import { type Interpolation, type Theme } from "@emotion/react";
44
import { Stack } from "components/Stack/Stack";
5-
import colors from "theme/tailwind";
65

76
const styles = {
87
badge: {

site/src/pages/UserSettingsPage/AppearancePage/AppearancePage.test.tsx

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { AppearancePage } from "./AppearancePage";
66
import { MockUser } from "testHelpers/entities";
77

88
describe("appearance page", () => {
9-
it("changes theme to dark", async () => {
9+
it("does nothing when selecting current theme", async () => {
1010
renderWithAuth(<AppearancePage />);
1111

1212
jest.spyOn(API, "updateAppearanceSettings").mockResolvedValueOnce({
@@ -18,10 +18,7 @@ describe("appearance page", () => {
1818
await userEvent.click(dark);
1919

2020
// Check if the API was called correctly
21-
expect(API.updateAppearanceSettings).toBeCalledTimes(1);
22-
expect(API.updateAppearanceSettings).toHaveBeenCalledWith("me", {
23-
theme_preference: "dark",
24-
});
21+
expect(API.updateAppearanceSettings).toBeCalledTimes(0);
2522
});
2623

2724
it("changes theme to dark blue", async () => {
@@ -41,4 +38,22 @@ describe("appearance page", () => {
4138
theme_preference: "darkBlue",
4239
});
4340
});
41+
42+
it("changes theme to light", async () => {
43+
renderWithAuth(<AppearancePage />);
44+
45+
jest.spyOn(API, "updateAppearanceSettings").mockResolvedValueOnce({
46+
...MockUser,
47+
theme_preference: "light",
48+
});
49+
50+
const light = await screen.findByText("Light");
51+
await userEvent.click(light);
52+
53+
// Check if the API was called correctly
54+
expect(API.updateAppearanceSettings).toBeCalledTimes(1);
55+
expect(API.updateAppearanceSettings).toHaveBeenCalledWith("me", {
56+
theme_preference: "light",
57+
});
58+
});
4459
});

site/src/pages/WorkspaceSettingsPage/WorkspaceSchedulePage/WorkspaceScheduleForm.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import { type ChangeEvent, type FC } from "react";
2929
import * as Yup from "yup";
3030
import { getFormHelpers } from "utils/formUtils";
3131
import { timeZones } from "utils/timeZones";
32-
import { Pill } from "components/Pill/Pill";
3332
import Tooltip from "@mui/material/Tooltip";
3433
import { formatDuration, intervalToDuration } from "date-fns";
3534
import { DisabledBadge } from "components/Badges/Badges";

0 commit comments

Comments
 (0)