feat: unify Person and User creation form with conditional password

This commit is contained in:
2026-06-16 21:48:59 +02:00
parent e5717461cf
commit 1f5a849bf5
21 changed files with 462 additions and 171 deletions
@@ -3,7 +3,6 @@ import { renderToStaticMarkup } from "react-dom/server"
import { beforeEach, describe, expect, it, vi } from "vitest"
import { en } from "@/i18n/dictionaries/en"
import { es } from "@/i18n/dictionaries/es"
const mocks = vi.hoisted(() => ({
getI18n: vi.fn(),
@@ -33,23 +32,6 @@ describe("person form schema wiring", () => {
vi.clearAllMocks()
})
it("passes server-resolved Person schema copy into the new person form boundary", async () => {
mocks.getI18n.mockResolvedValue({ dictionary: es, locale: "es" })
const { default: NewPersonPage } = await import(
"@/app/(dashboard)/people/new/page"
)
renderToStaticMarkup(await NewPersonPage())
expect(mocks.personForm).toHaveBeenCalledWith(
expect.objectContaining({
mode: "create",
schemaCopy: es.inventory.people.schema,
}),
)
})
it("passes server-resolved Person schema copy into the edit person form boundary", async () => {
mocks.getI18n.mockResolvedValue({ dictionary: en, locale: "en" })
mocks.findById.mockResolvedValue({