feat(people): align people, users, and categories with active inventory records
This commit is contained in:
@@ -58,11 +58,11 @@ describe("createPersonUserUseCase", () => {
|
||||
})
|
||||
|
||||
// No User record created
|
||||
await expect(
|
||||
prisma.user.findUnique({
|
||||
expect(
|
||||
await prisma.user.findUnique({
|
||||
where: { emailNormalized: normalizeEmail("john@example.test") },
|
||||
}),
|
||||
).resolves.toBeNull()
|
||||
).toBeNull()
|
||||
})
|
||||
|
||||
it("creates a Person with null email when not providing email and role is NO_USER", async () => {
|
||||
@@ -196,9 +196,9 @@ describe("createPersonUserUseCase", () => {
|
||||
if (!user.passwordHash) throw new Error("Expected password hash")
|
||||
|
||||
const { verifyPassword } = await import("@/lib/security")
|
||||
await expect(
|
||||
verifyPassword("plaintext-password", user.passwordHash),
|
||||
).resolves.toBe(true)
|
||||
expect(await verifyPassword("plaintext-password", user.passwordHash)).toBe(
|
||||
true,
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -221,7 +221,7 @@ describe("createPersonUserUseCase", () => {
|
||||
errors: { email: ["Email already exists"] },
|
||||
})
|
||||
|
||||
await expect(prisma.person.count()).resolves.toBe(1)
|
||||
expect(await prisma.person.count()).toBe(1)
|
||||
})
|
||||
|
||||
it("rejects submission when email already exists in User table", async () => {
|
||||
@@ -244,8 +244,8 @@ describe("createPersonUserUseCase", () => {
|
||||
})
|
||||
|
||||
// No new Person or User was created
|
||||
await expect(prisma.person.count()).resolves.toBe(0)
|
||||
await expect(prisma.user.count()).resolves.toBe(1)
|
||||
expect(await prisma.person.count()).toBe(0)
|
||||
expect(await prisma.user.count()).toBe(1)
|
||||
})
|
||||
|
||||
it("accepts submission when email is unique across both tables", async () => {
|
||||
|
||||
Reference in New Issue
Block a user