forked from syntaxbullet/aurorabot
refactor: Abbreviate item rarity values from full names to single-letter codes across the application.
This commit is contained in:
@@ -28,7 +28,7 @@ let mockItems: MockItem[] = [
|
||||
id: 1,
|
||||
name: "Health Potion",
|
||||
description: "Restores health",
|
||||
rarity: "Common",
|
||||
rarity: "C",
|
||||
type: "CONSUMABLE",
|
||||
price: 100n,
|
||||
iconUrl: "/assets/items/1.png",
|
||||
@@ -39,7 +39,7 @@ let mockItems: MockItem[] = [
|
||||
id: 2,
|
||||
name: "Iron Sword",
|
||||
description: "A basic sword",
|
||||
rarity: "Uncommon",
|
||||
rarity: "R",
|
||||
type: "EQUIPMENT",
|
||||
price: 500n,
|
||||
iconUrl: "/assets/items/2.png",
|
||||
@@ -96,7 +96,7 @@ mock.module("@shared/modules/items/items.service", () => ({
|
||||
id: mockIdCounter++,
|
||||
name: data.name,
|
||||
description: data.description ?? null,
|
||||
rarity: data.rarity ?? "Common",
|
||||
rarity: data.rarity ?? "C",
|
||||
type: data.type,
|
||||
price: data.price ?? null,
|
||||
iconUrl: data.iconUrl,
|
||||
@@ -154,7 +154,7 @@ describe("Items API", () => {
|
||||
id: 1,
|
||||
name: "Health Potion",
|
||||
description: "Restores health",
|
||||
rarity: "Common",
|
||||
rarity: "C",
|
||||
type: "CONSUMABLE",
|
||||
price: 100n,
|
||||
iconUrl: "/assets/items/1.png",
|
||||
@@ -165,7 +165,7 @@ describe("Items API", () => {
|
||||
id: 2,
|
||||
name: "Iron Sword",
|
||||
description: "A basic sword",
|
||||
rarity: "Uncommon",
|
||||
rarity: "R",
|
||||
type: "EQUIPMENT",
|
||||
price: 500n,
|
||||
iconUrl: "/assets/items/2.png",
|
||||
@@ -217,11 +217,11 @@ describe("Items API", () => {
|
||||
});
|
||||
|
||||
test("should filter items by rarity", async () => {
|
||||
const response = await fetch(`${baseUrl}/api/items?rarity=Common`);
|
||||
const response = await fetch(`${baseUrl}/api/items?rarity=C`);
|
||||
expect(response.status).toBe(200);
|
||||
|
||||
const data = (await response.json()) as { items: MockItem[]; total: number };
|
||||
expect(data.items.every((item) => item.rarity === "Common")).toBe(true);
|
||||
expect(data.items.every((item) => item.rarity === "C")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -255,7 +255,7 @@ describe("Items API", () => {
|
||||
const newItem = {
|
||||
name: "Magic Staff",
|
||||
description: "A powerful staff",
|
||||
rarity: "Rare",
|
||||
rarity: "SR",
|
||||
type: "EQUIPMENT",
|
||||
price: "1000",
|
||||
iconUrl: "/assets/items/placeholder.png",
|
||||
|
||||
Reference in New Issue
Block a user