morintd / prismock

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

date field `orderBy` doesn't compare different types #1144

Open electrovir opened 4 weeks ago

electrovir commented 4 weeks ago

Prisma allows creating date fields with a string value or a Date instance. If a mix of Date instances and strings are used with Prismock, however, orderBy don't properly compare the two.

Repro steps:

  1. create a schema with a date field
  2. create some rows with Date instances
  3. create some rows with (ISO formatted) date strings that are earlier than the dates in part 2
  4. try a .findMany operation with orderBy
  5. notice that rows from part 3 are incorrectly ordered after the rows from part 2