fix : not null artifact and weapon in team calc
CI / Build immutable images and deploy (push) Successful in 2m6s
CI / Build immutable images and deploy (push) Successful in 2m6s
This commit is contained in:
@@ -184,15 +184,17 @@ describe("structured guide validation", () => {
|
||||
});
|
||||
|
||||
it("requires four unique team members and non-zero damage", () => {
|
||||
const member = (characterKey: string) => ({ characterKey, weaponKey: null, artifactKey: null, secondArtifactKey: null, constellation: 0, refinement: 1, damage: 100 });
|
||||
const member = (characterKey: string) => ({ characterKey, weaponKey: "weapon-1", artifactKey: "artifact-1", secondArtifactKey: null, constellation: 0, refinement: 1, damage: 100 });
|
||||
const teams = [{ title: "Test", rotationSeconds: 20, combo: "E > Q", members: ["1", "2", "3", "4"].map(member) }];
|
||||
const base = { expectedVersion: 1, groups: [{ note: null, teams }] };
|
||||
expect(teamSectionSchema.safeParse(base).success).toBe(true);
|
||||
expect(teamSectionSchema.safeParse({ ...base, groups: [{ note: null, teams: [{ ...teams[0], members: ["1", "1", "3", "4"].map(member) }] }] }).success).toBe(false);
|
||||
expect(teamSectionSchema.safeParse({ ...base, groups: [{ note: null, teams: [{ ...teams[0], members: [{ ...member("1"), weaponKey: null }, ...["2", "3", "4"].map(member)] }] }] }).success).toBe(false);
|
||||
expect(teamSectionSchema.safeParse({ ...base, groups: [{ note: null, teams: [{ ...teams[0], members: [{ ...member("1"), artifactKey: null }, ...["2", "3", "4"].map(member)] }] }] }).success).toBe(false);
|
||||
});
|
||||
|
||||
it("accepts a second artifact set for a team member", () => {
|
||||
const member = (characterKey: string) => ({ characterKey, weaponKey: null, artifactKey: "artifact-1", secondArtifactKey: characterKey === "1" ? "artifact-2" : null, constellation: 0, refinement: 1, damage: 100 });
|
||||
const member = (characterKey: string) => ({ characterKey, weaponKey: "weapon-1", artifactKey: "artifact-1", secondArtifactKey: characterKey === "1" ? "artifact-2" : null, constellation: 0, refinement: 1, damage: 100 });
|
||||
const input = { expectedVersion: 1, groups: [{ note: null, teams: [{ title: "Test", rotationSeconds: 20, combo: "E > Q", members: ["1", "2", "3", "4"].map(member) }] }] };
|
||||
expect(teamSectionSchema.safeParse(input).success).toBe(true);
|
||||
});
|
||||
|
||||
@@ -156,8 +156,8 @@ export const teamSectionSchema = z.strictObject({
|
||||
combo: z.string().trim().min(1).max(2_000),
|
||||
members: z.array(z.strictObject({
|
||||
characterKey: catalogKey,
|
||||
weaponKey: catalogKey.nullable(),
|
||||
artifactKey: catalogKey.nullable(),
|
||||
weaponKey: catalogKey,
|
||||
artifactKey: catalogKey,
|
||||
secondArtifactKey: catalogKey.nullable(),
|
||||
constellation: z.number().int().min(0).max(6),
|
||||
refinement: z.number().int().min(1).max(5),
|
||||
|
||||
@@ -7,6 +7,7 @@ interface ValidationIssue {
|
||||
|
||||
const fieldMessages: Record<string, string> = {
|
||||
weaponKey: "กรุณาเลือกอาวุธ",
|
||||
artifactKey: "กรุณาเลือก Artifact",
|
||||
firstArtifactKey: "กรุณาเลือก Artifact ชุดแรก",
|
||||
characterKey: "กรุณาเลือกตัวละคร",
|
||||
overallPercent: "กรุณากรอก Overall % ระหว่าง -9,999 ถึง 9,999",
|
||||
|
||||
Reference in New Issue
Block a user