refactor: move unified Person+User form to /people/new, admin-only
This commit is contained in:
@@ -44,16 +44,6 @@ describe("person pages", () => {
|
||||
mocks.getI18n.mockResolvedValue({ dictionary: es, locale: "es" })
|
||||
})
|
||||
|
||||
it("redirects /people/new to /admin/users/new", async () => {
|
||||
const { default: NewPersonPage } = await import(
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
await NewPersonPage()
|
||||
|
||||
expect(mocks.redirect).toHaveBeenCalledWith("/admin/users/new")
|
||||
})
|
||||
|
||||
it("renders the edit person page with Person heading and no username", async () => {
|
||||
const { default: PersonEditPage } = await import(
|
||||
"@/app/(dashboard)/people/[personId]/edit/page"
|
||||
|
||||
@@ -47,7 +47,7 @@ describe("unified creation form page", () => {
|
||||
|
||||
it("renders unified form with Person fields, email, password, role, and NO_USER option in Spanish", async () => {
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
@@ -78,7 +78,7 @@ describe("unified creation form page", () => {
|
||||
mocks.getI18n.mockResolvedValue({ dictionary: en, locale: "en" })
|
||||
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
@@ -100,7 +100,7 @@ describe("unified creation form page", () => {
|
||||
|
||||
it("renders Person field placeholders from the unified form dictionary", async () => {
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
@@ -114,7 +114,7 @@ describe("unified creation form page", () => {
|
||||
|
||||
it("renders department select with all PERSON_DEPARTMENTS values", async () => {
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
|
||||
@@ -60,13 +60,13 @@ describe("new user form localization", () => {
|
||||
|
||||
it("renders new user page with localized title and unified form labels in Spanish", async () => {
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
|
||||
// Title
|
||||
expect(html).toContain("Nuevo usuario")
|
||||
expect(html).toContain("Nueva persona")
|
||||
|
||||
// Person field labels
|
||||
expect(html).toContain("Nombre")
|
||||
@@ -94,12 +94,12 @@ describe("new user form localization", () => {
|
||||
mocks.getI18n.mockResolvedValue({ dictionary: en, locale: "en" })
|
||||
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
|
||||
expect(html).toContain("New User")
|
||||
expect(html).toContain("New Person")
|
||||
|
||||
// Person fields
|
||||
expect(html).toContain("First Name")
|
||||
@@ -122,7 +122,7 @@ describe("new user form localization", () => {
|
||||
|
||||
it("keeps canonical role values in option value attributes including NO_USER, not localized labels", async () => {
|
||||
const { default: NewUserPage } = await import(
|
||||
"@/app/(dashboard)/admin/users/new/page"
|
||||
"@/app/(dashboard)/people/new/page"
|
||||
)
|
||||
|
||||
const html = renderToStaticMarkup(await NewUserPage())
|
||||
|
||||
@@ -22,7 +22,7 @@ describe("admin users dictionary", () => {
|
||||
},
|
||||
})
|
||||
|
||||
expect(users.new).toEqual({ title: "New User" })
|
||||
expect(users.new).toEqual({ title: "New Person" })
|
||||
expect(users.edit).toEqual({ title: "Edit User" })
|
||||
|
||||
expect(users.form).toEqual({
|
||||
@@ -114,7 +114,7 @@ describe("admin users dictionary", () => {
|
||||
},
|
||||
})
|
||||
|
||||
expect(users.new).toEqual({ title: "Nuevo usuario" })
|
||||
expect(users.new).toEqual({ title: "Nueva persona" })
|
||||
expect(users.edit).toEqual({ title: "Editar usuario" })
|
||||
|
||||
expect(users.form).toEqual({
|
||||
|
||||
Reference in New Issue
Block a user