feat : update
This commit is contained in:
@@ -29,6 +29,12 @@ describe("structured guide validation", () => {
|
||||
expect(artifactSectionSchema.safeParse({ ...base, groups: [...artifactGroups, { name: "Other", rows: [] }] }).success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts only talent target levels from 1 through 10", () => {
|
||||
const base = { expectedVersion: 1, groups: artifactGroups, sands: [], goblet: [], circlet: [], substats: [], targets: [], note: null };
|
||||
expect(artifactSectionSchema.safeParse({ ...base, talents: [{ type: "NA", priority: 1, level: "10" }] }).success).toBe(true);
|
||||
expect(artifactSectionSchema.safeParse({ ...base, talents: [{ type: "NA", priority: 1, level: "11" }] }).success).toBe(false);
|
||||
});
|
||||
|
||||
it("requires four unique team members and non-zero damage", () => {
|
||||
const member = (characterKey: string) => ({ characterKey, weaponKey: null, artifactKey: null, constellation: 0, refinement: 1, damage: 100 });
|
||||
const base = { expectedVersion: 1, teams: [{ title: "Test", rotationSeconds: 20, combo: "E > Q", members: ["1", "2", "3", "4"].map(member) }] };
|
||||
|
||||
@@ -37,6 +37,7 @@ export const mainStatOptions = {
|
||||
} as const;
|
||||
|
||||
export const substatOptions = ["CRIT Rate%/CRIT DMG%", "HP%", "ATK%", "DEF%", "EM", "ER"] as const;
|
||||
export const talentLevelOptions = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] as const;
|
||||
|
||||
const artifactGroupSchema = (name: "Late Game" | "Early Game") => z.strictObject({
|
||||
name: z.literal(name),
|
||||
@@ -64,7 +65,7 @@ export const artifactSectionSchema = z.strictObject({
|
||||
talents: z.array(z.strictObject({
|
||||
type: z.enum(["NA", "E", "Q"]),
|
||||
priority: z.number().int().min(1).max(3),
|
||||
level: z.string().trim().max(24).optional(),
|
||||
level: z.enum(talentLevelOptions).optional(),
|
||||
})).max(3),
|
||||
note: z.string().trim().max(2_000).nullable(),
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user