Skip to content

Commit

Permalink
Test missing property on FindXOrThrow returns null
Browse files Browse the repository at this point in the history
Closes #15887
Closes #10642

Co-authored-by: Sergey Tatarintsev <tatarintsev@prisma.io>
  • Loading branch information
2 people authored and jkomyno committed Dec 21, 2022
1 parent ec3fdab commit 1c5dfa2
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions packages/client/tests/functional/fluent-api/tests.ts
Expand Up @@ -149,6 +149,18 @@ testMatrix.setupTestSuite(() => {
expect(posts).toEqual([expect.objectContaining({ title })])
})

test('findFirstOrThrow where nested entity is not found', async () => {
const property = await prisma.user
.findFirstOrThrow({
where: {
email,
},
})
.property()

expect(property).toBeNull()
})

test('findUniqueOrThrow', async () => {
const posts = await prisma.user
.findUniqueOrThrow({
Expand All @@ -161,6 +173,18 @@ testMatrix.setupTestSuite(() => {
expect(posts).toEqual([expect.objectContaining({ title })])
})

test('findUniqueOrThrow where nested entity is not found', async () => {
const property = await prisma.user
.findUniqueOrThrow({
where: {
email,
},
})
.property()

expect(property).toBeNull()
})

test('create', async () => {
const posts = await prisma.user
.create({
Expand Down

0 comments on commit 1c5dfa2

Please sign in to comment.