Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/client/tests/functional/issues/14373-batch-tx-error/_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,24 @@ | ||
import { defineMatrix } from '../../_utils/defineMatrix' | ||
|
||
export default defineMatrix(() => [ | ||
[ | ||
{ | ||
provider: 'sqlite', | ||
}, | ||
{ | ||
provider: 'postgresql', | ||
}, | ||
{ | ||
provider: 'mysql', | ||
}, | ||
{ | ||
provider: 'mongodb', | ||
}, | ||
{ | ||
provider: 'cockroachdb', | ||
}, | ||
{ | ||
provider: 'sqlserver', | ||
}, | ||
], | ||
]) |
22 changes: 22 additions & 0 deletions
22
packages/client/tests/functional/issues/14373-batch-tx-error/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,22 @@ | ||
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 | ||
memo String? | ||
createdAt DateTime @default(now()) | ||
} | ||
` | ||
}) |
24 changes: 24 additions & 0 deletions
24
packages/client/tests/functional/issues/14373-batch-tx-error/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 @@ | ||
// @ts-ignore | ||
import type { PrismaClient } from '@prisma/client' | ||
|
||
import testMatrix from './_matrix' | ||
|
||
declare let prisma: PrismaClient | ||
|
||
testMatrix.setupTestSuite((suiteConfig, suiteMeta) => { | ||
test('correctly reports error location for batch tx', async () => { | ||
const result = prisma.$transaction([ | ||
prisma.user.findMany({}), | ||
prisma.user.update({ | ||
where: { | ||
id: 'not here', | ||
}, | ||
data: { | ||
memo: 'id is 1', | ||
}, | ||
}), | ||
]) | ||
|
||
await expect(result).rejects.toThrowError('Invalid `prisma.user.update()` invocation') | ||
}) | ||
}) |