Skip to content

Commit

Permalink
test: configs
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Sep 4, 2024
1 parent f0a423c commit 331cc8f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/configs/__tests__/colors.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import type { Theme } from "../../types/themeProps";
import getThemeColor, { colors } from "../colors";

describe("getThemeColor", () => {
it("should return the correct theme color", () => {
const theme = "light";
const key = "background";
const expectedColor = colors[theme][key];

const result = getThemeColor(theme, key);

expect(result).toBe(expectedColor);
});

it('should return "#fff" for invalid theme or key', () => {
const theme = "invalidTheme";
const key = "invalidKey";
const expectedColor = "#fff";

const result = getThemeColor(theme as Theme, key as "background");

expect(result).toBe(expectedColor);
});
});

0 comments on commit 331cc8f

Please sign in to comment.