Add flat artifact substats

This commit is contained in:
2026-09-01 15:33:51 +07:00 Unverified
parent aa0ba4be09
commit 4d815e3c6c
2 changed files with 10 additions and 1 deletions
+9
View File
@@ -2,6 +2,7 @@ import { describe, expect, it } from "vitest";
import { calculateTeamMetrics } from "@/lib/guides/calculations";
import { artifactSectionSchema, constellationSectionSchema, createGuideSchema, teamSectionSchema, weaponSectionSchema } from "@/lib/guides/schemas";
import { recommendedStatIconName, targetStatIconName } from "@/lib/guides/stats";
describe("structured guide validation", () => {
const artifactGroups = [
@@ -35,6 +36,14 @@ describe("structured guide validation", () => {
expect(result.success).toBe(false);
});
it("accepts flat artifact substats with the same icons as their percentage variants", () => {
const result = artifactSectionSchema.safeParse({ expectedVersion: 1, groups: artifactGroups, sands: [], goblet: [], circlet: [], substats: ["ATK", "HP", "DEF"], targets: [], talents: [], note: null });
expect(result.success).toBe(true);
expect(targetStatIconName("ATK")).toBe(recommendedStatIconName("ATK%"));
expect(targetStatIconName("HP")).toBe(recommendedStatIconName("HP%"));
expect(targetStatIconName("DEF")).toBe(recommendedStatIconName("DEF%"));
});
it("limits an optional note on each artifact recommendation", () => {
const row = { firstArtifactKey: "1", secondArtifactKey: null, percent: 100 };
const base = { expectedVersion: 1, sands: [], goblet: [], circlet: [], substats: [], targets: [], talents: [], note: null };
+1 -1
View File
@@ -40,7 +40,7 @@ export const mainStatOptions = {
circlet: ["HP%", "ATK%", "DEF%", "EM", "CRIT Rate%/CRIT DMG%", "Healing Bonus%"],
} as const;
export const substatOptions = ["CRIT Rate%/CRIT DMG%", "HP%", "ATK%", "DEF%", "EM", "ER"] as const;
export const substatOptions = ["CRIT Rate%/CRIT DMG%", "HP%", "HP", "ATK%", "ATK", "DEF%", "DEF", "EM", "ER"] as const;
export const talentLevelOptions = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10"] as const;
export const talentRelationOptions = ["gt", "gte"] as const;