feat : excel in website
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
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 {
|
||||
recommendedStatElement,
|
||||
@@ -207,6 +208,37 @@ describe("structured guide validation", () => {
|
||||
sections: [{ title: "Extra", rows: [{ ...row, catalogItems: [row.catalogItems[0], row.catalogItems[0]] }] }],
|
||||
}).success).toBe(false);
|
||||
});
|
||||
|
||||
it("validates an optional Extra card sheet", () => {
|
||||
let id = 0;
|
||||
const sheet = createExtraSheet((prefix) => `${prefix}-${++id}`);
|
||||
sheet.rows[0].cells[sheet.columns[0].id] = "=1+1";
|
||||
const row = {
|
||||
mediaId: null,
|
||||
heading: "Stats",
|
||||
body: "",
|
||||
percent: null,
|
||||
backgroundColor: null,
|
||||
highlights: [],
|
||||
catalogItems: [],
|
||||
sheet,
|
||||
};
|
||||
const result = extraSectionSchema.safeParse({
|
||||
expectedVersion: 1,
|
||||
sections: [{ title: "Extra", rows: [row] }],
|
||||
});
|
||||
expect(result.success).toBe(true);
|
||||
if (result.success) {
|
||||
expect(result.data.sections[0].rows[0].sheet?.rows[0].cells[sheet.columns[0].id]).toBe("=1+1");
|
||||
}
|
||||
|
||||
const invalidSheet = structuredClone(sheet);
|
||||
invalidSheet.rows[0].cells.missing = "orphan";
|
||||
expect(extraSectionSchema.safeParse({
|
||||
expectedVersion: 1,
|
||||
sections: [{ title: "Extra", rows: [{ ...row, sheet: invalidSheet }] }],
|
||||
}).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Team Calc", () => {
|
||||
|
||||
Reference in New Issue
Block a user