Files
buzz-sheet/lib/catalog/element.test.ts
T

22 lines
964 B
TypeScript

import { describe, expect, it } from "vitest";
import { elementBackgroundColor } from "@/lib/catalog/element";
describe("catalog element backgrounds", () => {
it("maps every character element to its 40% opacity color", () => {
expect(elementBackgroundColor("Pyro")).toBe("#12000066");
expect(elementBackgroundColor("Hydro")).toBe("#00051266");
expect(elementBackgroundColor("Anemo")).toBe("#06141566");
expect(elementBackgroundColor("Electro")).toBe("#0D000F66");
expect(elementBackgroundColor("Dendro")).toBe("#000F0466");
expect(elementBackgroundColor("Cryo")).toBe("#03202166");
expect(elementBackgroundColor("Geo")).toBe("#0F0D0066");
});
it("uses the neutral character background when the element is unavailable", () => {
expect(elementBackgroundColor(null)).toBe("#17383d66");
expect(elementBackgroundColor(undefined)).toBe("#17383d66");
expect(elementBackgroundColor("Unknown")).toBe("#17383d66");
});
});