Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(client): regression test for #16195
- Loading branch information
Showing
3 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
packages/client/tests/functional/issues/16195-index-out-of-bounds/_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', | ||
}, | ||
], | ||
]) |
19 changes: 19 additions & 0 deletions
19
packages/client/tests/functional/issues/16195-index-out-of-bounds/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,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)} | ||
} | ||
` | ||
}) |
15 changes: 15 additions & 0 deletions
15
packages/client/tests/functional/issues/16195-index-out-of-bounds/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,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()]) | ||
}) | ||
}) |