Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(client): wrong error for multiple queries in tx #15433
- Loading branch information
Showing
4 changed files
with
57 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
packages/client/tests/functional/issues/15433-wrong-error-query-tx/_matrix.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { defineMatrix } from '../../_utils/defineMatrix' | ||
|
||
export default defineMatrix(() => [ | ||
[ | ||
{ | ||
provider: 'sqlite', | ||
}, | ||
], | ||
]) |
20 changes: 20 additions & 0 deletions
20
packages/client/tests/functional/issues/15433-wrong-error-query-tx/prisma/_schema.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { idForProvider } from '../../../_utils/idForProvider' | ||
import testMatrix from '../_matrix' | ||
|
||
export default testMatrix.setupSchema(({ provider }) => { | ||
return /* Prisma */ ` | ||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
datasource db { | ||
provider = "${provider}" | ||
url = env("DATABASE_URI_${provider}") | ||
} | ||
model User { | ||
id ${idForProvider(provider)} | ||
email String @unique | ||
} | ||
` | ||
}) |
24 changes: 24 additions & 0 deletions
24
packages/client/tests/functional/issues/15433-wrong-error-query-tx/tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import testMatrix from './_matrix' | ||
// @ts-ignore | ||
import type { PrismaClient } from './node_modules/@prisma/client' | ||
|
||
declare let prisma: PrismaClient | ||
|
||
testMatrix.setupTestSuite( | ||
(suiteConfig, suiteMeta) => { | ||
test('example', async () => { | ||
await prisma.$transaction([ | ||
prisma.user.create({ data: { email: 'john1@doe.io' } }), | ||
prisma.user.create({ data: { email: 'john2@doe.io' } }), | ||
prisma.user.create({ data: { email: 'john3@doe.io' } }), | ||
prisma.user.create({ data: { email: 'john1@doe.io' } }), | ||
]) | ||
}) | ||
}, | ||
{ | ||
optOut: { | ||
from: ['postgresql', 'mysql', 'mongodb', 'cockroachdb', 'sqlserver'], | ||
reason: 'this is something that is handled by the client', | ||
}, | ||
}, | ||
) |