/
githubmirror
/
github-readme-stats
Обзор
Документация
Войти
/
githubmirror
/
github-readme-stats
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
tests/color.test.js
76 строк
2 KB
Ophelia Goldstein
refactor: move color related tests into separate file (#4564)
13 окт 2025, 20:39
Не верифицирован
13 окт 2025, 20:39
c1d13ea
Код
Авторство
О чём код?
import { getCardColors } from "../src/common/color"; import { describe, expect, it } from "@jest/globals"; describe("Test color.js", () => { it("getCardColors: should return expected values", () => { let colors = getCardColors({ title_color: "f00", text_color: "0f0", ring_color: "0000ff", icon_color: "00f", bg_color: "fff", border_color: "fff", theme: "dark", }); expect(colors).toStrictEqual({ titleColor: "#f00", textColor: "#0f0", iconColor: "#00f", ringColor: "#0000ff", bgColor: "#fff", borderColor: "#fff", }); }); it("getCardColors: should fallback to default colors if color is invalid", () => { let colors = getCardColors({ title_color: "invalidcolor", text_color: "0f0", icon_color: "00f", bg_color: "fff", border_color: "invalidColor", theme: "dark", }); expect(colors).toStrictEqual({ titleColor: "#2f80ed", textColor: "#0f0", iconColor: "#00f", ringColor: "#2f80ed", bgColor: "#fff", borderColor: "#e4e2e2", }); }); it("getCardColors: should fallback to specified theme colors if is not defined", () => { let colors = getCardColors({ theme: "dark", }); expect(colors).toStrictEqual({ titleColor: "#fff", textColor: "#9f9f9f", ringColor: "#fff", iconColor: "#79ff97", bgColor: "#151515", borderColor: "#e4e2e2", }); }); it("getCardColors: should return ring color equal to title color if not ring color is defined", () => { let colors = getCardColors({ title_color: "f00", text_color: "0f0", icon_color: "00f", bg_color: "fff", border_color: "fff", theme: "dark", }); expect(colors).toStrictEqual({ titleColor: "#f00", textColor: "#0f0", iconColor: "#00f", ringColor: "#f00", bgColor: "#fff", borderColor: "#fff", }); }); });