fix(schemas): fix asset schema Zod generic and form test types

This commit is contained in:
stock-manager-bot
2026-06-25 19:54:46 +02:00
parent 44565e3a62
commit 9b023ee558
3 changed files with 6 additions and 5 deletions
+2 -1
View File
@@ -68,7 +68,8 @@ function requirePersonWhenAssigned<T extends z.ZodTypeAny>(
copy: AssetSchemaCopy,
) {
return schema.superRefine((data, ctx) => {
if (data.status === "ASSIGNED" && !data.personId) {
const value = data as { status?: string; personId?: string | undefined }
if (value.status === "ASSIGNED" && !value.personId) {
ctx.addIssue({
code: "custom",
path: ["personId"],
@@ -96,7 +96,7 @@ describe("edit asset form", () => {
processing: "Processing",
success: "Success",
},
}),
} as never),
)
expect(html).toContain("Asset Tag")
@@ -182,7 +182,7 @@ describe("edit asset form", () => {
processing: "Processing",
success: "Success",
},
}),
} as never),
)
for (const status of [
@@ -79,7 +79,7 @@ describe("new asset form", () => {
processing: "Processing",
success: "Success",
},
}),
} as never),
)
expect(html).toContain("Asset Tag")
@@ -149,7 +149,7 @@ describe("new asset form", () => {
processing: "Processing",
success: "Success",
},
}),
} as never),
)
expect(html).toContain('value="AVAILABLE"')