Mocking return values
Course: Testing in the MERN Stack - chapter 10
You can mock the values returned from a mock by using mockResolvedValue
Update index.test.ts
import { prismaClient } from '../__mocks__/db'
prismaClient.sum.create.mockResolvedValue({ id: 1, a: 1, b: 1, result: 3});Final index.test.ts
$1b💡 We only need to mock in one of the tests because in the second one, control never reaches the place where
idis needed