-
Please post an example if you have a working one. What is the right syntax to mock methods like import db from "db"
jest.mock('db', () => ({
...jest.requireActual<object>("db")!,
someTable: () => ({
findMany: () => jest.fn(),
}),
})) Error: > yarn test emailNetwork.test.ts --watch
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
at getConfig (node_modules/@blitzjs/config/dist/blitzjs-config.cjs.dev.js:56:18)
ReferenceError: You are trying to `import` a file after the Jest environment has been torn down.
at getConfig (node_modules/@blitzjs/config/dist/blitzjs-config.cjs.dev.js:98:40) |
Beta Was this translation helpful? Give feedback.
Answered by
beerose
Jan 20, 2022
Replies: 1 comment 1 reply
-
Hi, here's Prisma's docs on unit testing and mocking prisma: https://www.prisma.io/docs/guides/testing/unit-testing. It should work with Blitz too. |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
mkondel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, here's Prisma's docs on unit testing and mocking prisma: https://www.prisma.io/docs/guides/testing/unit-testing. It should work with Blitz too.