fix : fix export image not like the actual
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { rarityGradient, rarityGradientClass, rarityTextClass } from "@/lib/catalog/rarity";
|
||||
import { rarityGradient, rarityGradientClass, rarityTextClass, rarityTextColor } from "@/lib/catalog/rarity";
|
||||
|
||||
describe("catalog rarity backgrounds", () => {
|
||||
it("maps every weapon and artifact rarity to its Tailwind gradient", () => {
|
||||
@@ -15,11 +15,15 @@ describe("catalog rarity backgrounds", () => {
|
||||
expect(rarityTextClass(3)).toBe("text-[#4D7691]");
|
||||
expect(rarityTextClass(4)).toBe("text-[#6D6A9C]");
|
||||
expect(rarityTextClass(5)).toBe("text-[#A67B34]");
|
||||
expect(rarityTextColor(3)).toBe("#4D7691");
|
||||
expect(rarityTextColor(4)).toBe("#6D6A9C");
|
||||
expect(rarityTextColor(5)).toBe("#A67B34");
|
||||
});
|
||||
|
||||
it("uses the neutral equipment background when rarity is unavailable", () => {
|
||||
expect(rarityGradient(null)).toBe("#17383d");
|
||||
expect(rarityGradientClass(undefined)).toBeUndefined();
|
||||
expect(rarityTextClass(undefined)).toBeUndefined();
|
||||
expect(rarityTextColor(undefined)).toBe("#17171c");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -20,6 +20,12 @@ const rarityTextClasses: Record<number, string> = {
|
||||
5: "text-[#A67B34]",
|
||||
};
|
||||
|
||||
const rarityTextColors: Record<number, string> = {
|
||||
3: "#4D7691",
|
||||
4: "#6D6A9C",
|
||||
5: "#A67B34",
|
||||
};
|
||||
|
||||
export function rarityGradientClass(rarity: number | null | undefined): string | undefined {
|
||||
return rarity ? rarityGradientClasses[rarity] : undefined;
|
||||
}
|
||||
@@ -31,3 +37,7 @@ export function rarityGradient(rarity: number | null | undefined): string {
|
||||
export function rarityTextClass(rarity: number | null | undefined): string | undefined {
|
||||
return rarity ? rarityTextClasses[rarity] : undefined;
|
||||
}
|
||||
|
||||
export function rarityTextColor(rarity: number | null | undefined): string {
|
||||
return (rarity && rarityTextColors[rarity]) || "#17171c";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user