feat(guides): organize schemas and export teams
CI / Verify (push) Successful in 1m6s
CI / Build immutable images and deploy (push) Successful in 2m19s

This commit is contained in:
2026-08-29 18:52:01 +00:00 Unverified
parent ac9a733370
commit 17214a3625
13 changed files with 3751 additions and 46 deletions
+11 -1
View File
@@ -1,6 +1,10 @@
import { describe, expect, it } from "vitest";
import { cleanLunarisText, constellationSnapshot } from "@/lib/catalog/lunaris";
import {
characterDetailSchema,
cleanLunarisText,
constellationSnapshot,
} from "@/lib/catalog/lunaris";
describe("Lunaris character data", () => {
it("removes display markup from constellation text", () => {
@@ -20,4 +24,10 @@ describe("Lunaris character data", () => {
iconKey: "catalog/1/constellations/UI_Talent_Test_01.webp",
}]);
});
it("accepts characters that do not have constellations", () => {
const detail = characterDetailSchema.parse({ constellations: null });
expect(constellationSnapshot(detail, (icon) => icon)).toEqual([]);
});
});
+2 -2
View File
@@ -14,7 +14,7 @@ const constellationSchema = z.object({
});
export const characterDetailSchema = z.object({
constellations: z.record(z.string(), constellationSchema),
constellations: z.record(z.string(), constellationSchema).nullish(),
});
export function cleanLunarisText(value: string): string {
@@ -32,7 +32,7 @@ export function constellationSnapshot(
const result: CatalogConstellation[] = [];
for (const index of Array.from({ length: 6 }, (_, itemIndex) => itemIndex)) {
const level = index + 1;
const item = value.constellations[`const${level}`];
const item = value.constellations?.[`const${level}`];
if (!item) continue;
result.push({
level,