-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
tests.ts
65 lines (57 loc) · 1.46 KB
/
tests.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import testMatrix from './_matrix'
// @ts-ignore
import type { PrismaClient } from './node_modules/@prisma/client'
declare let prisma: PrismaClient
// https://github.com/prisma/prisma/issues/13089
testMatrix.setupTestSuite(
() => {
beforeAll(async () => {
await prisma.users.create({
data: {
firstName: 'foo',
},
})
await prisma.users.create({
data: {
firstName: '$foo',
},
})
})
test('should return records when using a `$` in the search string', async () => {
const records = await prisma.users.findMany({
where: {
firstName: '$foo',
},
})
expect(records).toHaveLength(1)
expect(records[0].firstName).toEqual('$foo')
})
test('should update records when using a `$` in the search string', async () => {
const record = await prisma.users.update({
where: {
firstName: '$foo',
},
data: {
firstName: '$$foo',
},
select: {
firstName: true,
},
})
expect(record.firstName).toEqual('$$foo')
})
test('should delete records when using a `$` in the search string', async () => {
await prisma.users.delete({
where: {
firstName: '$$foo',
},
})
})
},
{
optOut: {
from: ['cockroachdb', 'mysql', 'postgresql', 'sqlite', 'sqlserver'],
reason: 'Only applicable to Mongodb',
},
},
)