I get a `TypeError: this.prisma.user.findFirst is ...
# orm-help
p
I get a `TypeError: this.prisma.user.findFirst is not a function`in my unit tests with this function:
Copy code
async getUserByMail(email: string): Promise<User | null> {
    // return this.prisma.user.findUnique({ where: { email } }); // <- this works

    // this fails in unit tests:
    return this.prisma.user.findFirst({
      where: {
        email: {
          equals: email,
          mode: 'insensitive',
        },
      },
    });
  }
Anybody knows what the issue could be?
findUnique
works fine, but I need to find the mail case insensitive and
findUnique
doesnt seem to support this.
r
@Patrick 👋 What version of
prisma
and
@prisma/client
are you on?
p
I tried with both
2.17.0
as well as
2.28.0
r
It should work in tests if it’s working in code. Does updating both cli and client to the latest version solve it?
p
I tried upgrading again to latest
2.28.0
for
@prisma/client
and
prisma
packages and made a fresh
npx prisma generate
but without success. Maybe this is some quirk with
jest
and
ts-jest
but I can't wrap my head around whats wrong as the corresponding generated type files have the function available
Nevermind, I'm stupid. It was an issue with mocked functions