prismock icon indicating copy to clipboard operation
prismock copied to clipboard

Queries with nested wheres don't work

Open NatalieFrecka opened this issue 5 months ago • 0 comments

First of all, this library is great so far. It's saved me a ton of work. Prisma is really lacking when it comes to unit testing, so I really appreciate the dedication.

This might be an expected issue since most nesting doesn't seem to be covered, but I don't see any mention of nested where clauses in the README, so I figured I'd bring it up.

prisma.caseStudy.findFirst({
    orderBy: { lastUpdated: "desc" },
    where: {
      location: {
        companyId: { id: companyId },
      },
    },
});
prisma.user.findMany({
    where: {
        companyId: { id: companyId }, 
    },
});

The above examples do not work when unit testing. I always get back the most recently updated CaseStudy not matter what Company Id is provided.

if it helps: A Company can have many Locations A Location can only have one Company A CaseStudy can only have one Location A Location can have many CaseStudies

I'm on prismock version 1.33.1.

NatalieFrecka avatar Sep 18 '24 17:09 NatalieFrecka