Merge custom option test fix into mobile boards

This commit is contained in:
Thomas Camlong committed 2026-08-09 18:08:39 +02:00
commit 2c97eec1d0
32 files changed
+798 -238

No files matched your search

+10 -2
View File
@@ -88,8 +88,16 @@ describe("section behavior validation", () => {
});
});
test.each(["category", "dynamic"])("rejects the legacy %s kind", (kind) => {
expect(() => sectionSchema.parse({ id: "legacy", kind, layouts: [] })).toThrow();
test("normalizes the legacy dynamic kind to a container", () => {
expect(sectionSchema.parse({ id: "legacy", kind: "dynamic", layouts: [] })).toMatchObject({
id: "legacy",
kind: "container",
layouts: [],
});
});
test("rejects the legacy category kind", () => {
expect(() => sectionSchema.parse({ id: "legacy", kind: "category", layouts: [] })).toThrow();
});
test.each([
+5 -1
View File
@@ -93,4 +93,8 @@ const containerSectionSchema = z.object({
),
});
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema]);
const legacyDynamicSectionSchema = containerSectionSchema
.extend({ kind: z.literal("dynamic") })
.transform((section) => ({ ...section, kind: "container" as const }));
export const sectionSchema = z.union([emptySectionSchema, containerSectionSchema, legacyDynamicSectionSchema]);