forked from prisma/prisma
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(client): integration test for prisma#12651
- Loading branch information
1 parent
323a781
commit 5b93a1a
Showing
4 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
1 change: 1 addition & 0 deletions
1
packages/client/src/__tests__/integration/happy/large-floats/.gitignore
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 @@ | ||
!dev.db |
Binary file not shown.
13 changes: 13 additions & 0 deletions
13
packages/client/src/__tests__/integration/happy/large-floats/schema.prisma
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,13 @@ | ||
datasource db { | ||
provider = "sqlite" | ||
url = "file:./dev.db" | ||
} | ||
|
||
generator client { | ||
provider = "prisma-client-js" | ||
} | ||
|
||
model Floats { | ||
id String @id @default(uuid()) | ||
value Float | ||
} |
32 changes: 32 additions & 0 deletions
32
packages/client/src/__tests__/integration/happy/large-floats/test.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,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() | ||
}) |