Skip to content

Commit

Permalink
chore: type coverage test (#1831)
Browse files Browse the repository at this point in the history
  • Loading branch information
ymc9 authored Nov 6, 2024
1 parent 5f15fe0 commit 9cc01d5
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions tests/integration/tests/enhancements/json/typing.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,58 @@ async function main() {
const u2 = await db.user.findMany();
console.log(u2[0].profile.address?.city);
await db.user.create({ data: { profile: { age: 20 } } });
}
`,
},
],
}
);
});

it('type coverage', async () => {
await loadSchema(
`
type Profile {
boolean Boolean
bigint BigInt
int Int
float Float
decimal Decimal
string String
bytes Bytes
dateTime DateTime
json Json
}
model User {
id Int @id @default(autoincrement())
profile Profile @json
@@allow('all', true)
}
`,
{
provider: 'postgresql',
pushDb: false,
compile: true,
extraSourceFiles: [
{
name: 'main.ts',
content: `
import type { Profile } from '.zenstack/models';
import { Prisma } from '@prisma/client';
async function main() {
const profile: Profile = {
boolean: true,
bigint: BigInt(9007199254740991),
int: 100,
float: 1.23,
decimal: new Prisma.Decimal(1.2345),
string: 'string',
bytes: new Uint8Array([0, 1, 2, 3]),
dateTime: new Date(),
json: { a: 1 },
}
}
`,
},
Expand Down

0 comments on commit 9cc01d5

Please sign in to comment.