Skip to content

Commit

Permalink
test(client): integration test for prisma#12651
Browse files Browse the repository at this point in the history
  • Loading branch information
cmd-johnson committed Oct 19, 2022
1 parent 323a781 commit 5b93a1a
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 0 deletions.
@@ -0,0 +1 @@
!dev.db
Binary file not shown.
@@ -0,0 +1,13 @@
datasource db {
provider = "sqlite"
url = "file:./dev.db"
}

generator client {
provider = "prisma-client-js"
}

model Floats {
id String @id @default(uuid())
value Float
}
@@ -0,0 +1,32 @@
import { getTestClient } from '../../../../utils/getTestClient'

test('large-floats', async () => {
const PrismaClient = await getTestClient()
const prisma = new PrismaClient()

const largeFloat = await prisma.floats.create({
data: { value: 1e20 },
})
const negativeFloat = await prisma.floats.create({
data: { value: -1e20 },
})
const largeInteger = await prisma.floats.create({
data: { value: Number.MAX_SAFE_INTEGER },
})
const negativeInteger = await prisma.floats.create({
data: { value: Number.MIN_SAFE_INTEGER },
})
const otherFloat = await prisma.floats.create({
data: { value: 13.37 },
})

expect(largeFloat.value).toEqual(1e20)
expect(negativeFloat.value).toEqual(-1e20)
expect(largeInteger.value).toEqual(Number.MAX_SAFE_INTEGER)
expect(negativeInteger.value).toEqual(Number.MIN_SAFE_INTEGER)
expect(otherFloat.value).toEqual(13.37)

await prisma.floats.deleteMany()

await prisma.$disconnect()
})

0 comments on commit 5b93a1a

Please sign in to comment.