Skip to content

Commit e7f5931

Browse files
committed
test(theme): add tests for getThemeModeScript function
1 parent bbafda4 commit e7f5931

File tree

1 file changed

+23
-1
lines changed

1 file changed

+23
-1
lines changed

packages/ui/src/theme/mode-script.test.tsx

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { render } from "@testing-library/react";
22
import { describe, expect, it } from "vitest";
3-
import { ThemeModeScript } from "./mode-script";
3+
import { getThemeModeScript, ThemeModeScript } from "./mode-script";
44

55
describe("ThemeModeScript", () => {
66
it("should render with default props", () => {
@@ -47,3 +47,25 @@ describe("ThemeModeScript", () => {
4747
expect(script?.innerHTML).toContain('const className = "dark"');
4848
});
4949
});
50+
51+
describe("getThemeModeScript", () => {
52+
it("should return the correct script for prefix and version 3", () => {
53+
const script = getThemeModeScript({ prefix: "custom-", version: 3 });
54+
expect(script).toContain('const className = "custom-dark"');
55+
});
56+
57+
it("should return the correct script for prefix and version 4", () => {
58+
const script = getThemeModeScript({ prefix: "custom-", version: 4 });
59+
expect(script).toContain('const className = "dark"');
60+
});
61+
62+
it("should return the correct script for version 3", () => {
63+
const script = getThemeModeScript({ version: 3 });
64+
expect(script).toContain('const className = "dark"');
65+
});
66+
67+
it("should return the correct script for version 4", () => {
68+
const script = getThemeModeScript({ version: 4 });
69+
expect(script).toContain('const className = "dark"');
70+
});
71+
});

0 commit comments

Comments
 (0)