Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading