fix: add JSDoc header and null input test for rarity config
This commit is contained in:
@@ -18,6 +18,11 @@ describe("getRarityConfig", () => {
|
|||||||
const result = getRarityConfig("LEGENDARY");
|
const result = getRarityConfig("LEGENDARY");
|
||||||
expect(result).toEqual(RARITY_CONFIG["C"]);
|
expect(result).toEqual(RARITY_CONFIG["C"]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("falls back to Common for null/undefined input", () => {
|
||||||
|
expect(getRarityConfig(null as any)).toEqual(RARITY_CONFIG["C"]);
|
||||||
|
expect(getRarityConfig(undefined as any)).toEqual(RARITY_CONFIG["C"]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("defaultName", () => {
|
describe("defaultName", () => {
|
||||||
|
|||||||
@@ -1,3 +1,8 @@
|
|||||||
|
/**
|
||||||
|
* Shared Rarity Configuration
|
||||||
|
* Provides the canonical rarity display config (colors, emoji, labels)
|
||||||
|
* used by lootbox pull results and shop loot table views.
|
||||||
|
*/
|
||||||
export const RARITY_CONFIG: Record<string, { color: number; emoji: string; label: string }> = {
|
export const RARITY_CONFIG: Record<string, { color: number; emoji: string; label: string }> = {
|
||||||
C: { color: 0x95A5A6, emoji: "📦", label: "Common" },
|
C: { color: 0x95A5A6, emoji: "📦", label: "Common" },
|
||||||
R: { color: 0x3498DB, emoji: "📦", label: "Rare" },
|
R: { color: 0x3498DB, emoji: "📦", label: "Rare" },
|
||||||
|
|||||||
Reference in New Issue
Block a user