Skip to content

Commit

Permalink
chore: Reproduction for #14373
Browse files Browse the repository at this point in the history
  • Loading branch information
SevInf committed Oct 17, 2022
1 parent 1343c82 commit 6cbed47
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
@@ -0,0 +1,24 @@
import { defineMatrix } from '../../_utils/defineMatrix'

export default defineMatrix(() => [
[
{
provider: 'sqlite',
},
{
provider: 'postgresql',
},
{
provider: 'mysql',
},
{
provider: 'mongodb',
},
{
provider: 'cockroachdb',
},
{
provider: 'sqlserver',
},
],
])
@@ -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())
}
`
})
@@ -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')
})
})

0 comments on commit 6cbed47

Please sign in to comment.