-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f0a423c
commit 331cc8f
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); | ||
}); |