morintd / prismock

A mock for PrismaClient, dedicated to unit testing.
https://www.npmjs.com/package/prismock
MIT License
203 stars 23 forks source link

feat: support dbgenerated id type #1148

Open ludalex opened 3 weeks ago

ludalex commented 3 weeks ago

This adds support for having dbgenerated() ids in your schema while still being able to use prismock to create entries without explicitly passing the id.

Previously, in a schema file with ids defined like this:

model Thing {
  id String @id @default(dbgenerated("gen_random_uuid()")) @db.Uuid
  ...

Calling prismock.thing.create({}) would result in an object with an undefined id.