Skip to content

Commit 9efd8c6

Browse files
committed
test: add a test case
1 parent b80bec7 commit 9efd8c6

3 files changed

Lines changed: 71 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { defineMatrix } from '../../_utils/defineMatrix'
2+
import { Providers } from '../../_utils/providers'
3+
4+
export default defineMatrix(() => [[{ provider: Providers.SQLITE }]])
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { idForProvider } from '../../../_utils/idForProvider'
2+
import testMatrix from '../_matrix'
3+
4+
export default testMatrix.setupSchema(({ provider }) => {
5+
return /* Prisma */ `
6+
generator client {
7+
provider = "prisma-client-js"
8+
}
9+
10+
datasource db {
11+
provider = "${provider}"
12+
}
13+
14+
model Organization {
15+
id ${idForProvider(provider, { includeDefault: true })}
16+
types OrganizationType[]
17+
}
18+
19+
model OrganizationType {
20+
organizationId String
21+
type Int
22+
organization Organization @relation(fields: [organizationId], references: [id], onDelete: Cascade)
23+
@@id([organizationId, type])
24+
}
25+
`
26+
})
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import testMatrix from './_matrix'
2+
// @ts-ignore
3+
import type { PrismaClient } from './generated/prisma/client'
4+
5+
declare let prisma: PrismaClient
6+
7+
testMatrix.setupTestSuite(
8+
() => {
9+
test('should not duplicate rows for a nested "some ... in" query', async () => {
10+
await prisma.organization.create({
11+
data: {
12+
types: {
13+
createMany: {
14+
data: [{ type: 1 }, { type: 10 }],
15+
},
16+
},
17+
},
18+
})
19+
20+
expect(
21+
await prisma.organization.count({
22+
where: {
23+
types: {
24+
some: {
25+
type: {
26+
in: [1, 10],
27+
},
28+
},
29+
},
30+
},
31+
}),
32+
).toBe(1)
33+
})
34+
},
35+
{
36+
optOut: {
37+
from: ['mongodb', 'sqlite', 'sqlserver', 'postgresql', 'mysql', 'cockroachdb'],
38+
reason: 'this test is for a SQlite implementation bug',
39+
},
40+
},
41+
)

0 commit comments

Comments
 (0)