feat : update
This commit is contained in:
@@ -2,7 +2,18 @@ import { describe, expect, it } from "vitest";
|
||||
|
||||
import { calculateTeamMetrics } from "@/lib/guides/calculations";
|
||||
import { createExtraSheet } from "@/lib/guides/extra-sheet";
|
||||
import { artifactSectionSchema, constellationSectionSchema, createGuideSchema, extraSectionSchema, teamSectionSchema, updateGuideSchema, weaponSectionSchema } from "@/lib/guides/schemas";
|
||||
import {
|
||||
artifactSectionSchema,
|
||||
constellationSectionSchema,
|
||||
createExtraSectionSchema,
|
||||
createGuideSchema,
|
||||
extraSectionSchema,
|
||||
reorderExtraSectionsSchema,
|
||||
saveExtraSectionSchema,
|
||||
teamSectionSchema,
|
||||
updateGuideSchema,
|
||||
weaponSectionSchema,
|
||||
} from "@/lib/guides/schemas";
|
||||
import {
|
||||
recommendedStatElement,
|
||||
recommendedStatIconName,
|
||||
@@ -245,6 +256,29 @@ describe("structured guide validation", () => {
|
||||
sections: [{ title: "Extra", rows: [{ ...row, sheet: invalidSheet }] }],
|
||||
}).success).toBe(false);
|
||||
});
|
||||
|
||||
it("validates targeted Extra create, save, and reorder inputs", () => {
|
||||
const section = {
|
||||
title: "Build notes",
|
||||
rows: [{
|
||||
mediaId: null,
|
||||
heading: "Rotation",
|
||||
body: "",
|
||||
percent: null,
|
||||
backgroundColor: null,
|
||||
highlights: [],
|
||||
catalogItems: [],
|
||||
sheet: null,
|
||||
}],
|
||||
};
|
||||
const firstId = "550e8400-e29b-41d4-a716-446655440000";
|
||||
const secondId = "d9428888-122b-11e1-b85c-61cd3cbb3210";
|
||||
|
||||
expect(createExtraSectionSchema.parse({ title: " Build notes " }).title).toBe("Build notes");
|
||||
expect(saveExtraSectionSchema.safeParse({ expectedVersion: 2, section }).success).toBe(true);
|
||||
expect(reorderExtraSectionsSchema.safeParse({ expectedVersion: 2, sectionIds: [firstId, secondId] }).success).toBe(true);
|
||||
expect(reorderExtraSectionsSchema.safeParse({ expectedVersion: 2, sectionIds: [firstId, firstId] }).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Team Calc", () => {
|
||||
|
||||
Reference in New Issue
Block a user