prismock icon indicating copy to clipboard operation
prismock copied to clipboard

Support for _count for related records

Open thw0rted opened this issue 1 year ago • 0 comments

Using Prismock 1.33.1. Our code under test looks like

prisma.user.findMany({
  include: {
    post: {
      orderBy: { date: 'desc' },
      select: { id: true, name: true },
      take: 5
    },
    _count: {
      select: { post: true },
    }
  }
})

The idea being to get the name and ID of the most recent 5 posts by each user, along with a count of all their posts. Prismock seems to be ignoring the _count option. When running tests, no _count is present on the results.

I think this might be what the README means when it says that "select + count" is unsupported. If that's the case, what would it take to add support?

thw0rted avatar Oct 07 '24 14:10 thw0rted