Skip to content

Commit

Permalink
test(client): regression test for #16195 (#16214)
Browse files Browse the repository at this point in the history
  • Loading branch information
millsp authored and jkomyno committed Dec 21, 2022
1 parent 5bdc56c commit c09452c
Show file tree
Hide file tree
Showing 3 changed files with 58 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,19 @@
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)}
}
`
})
@@ -0,0 +1,15 @@
import { randomBytes } from 'crypto'

import testMatrix from './_matrix'
// @ts-ignore
import type { PrismaClient } from './node_modules/@prisma/client'

declare let prisma: PrismaClient

const id = randomBytes(12).toString('hex')

testMatrix.setupTestSuite((suiteConfig, suiteMeta) => {
test('transaction', async () => {
await prisma.$transaction([prisma.user.findUnique({ where: { id } }), prisma.user.findMany()])
})
})

0 comments on commit c09452c

Please sign in to comment.