I found this library that a colleague of mine wrote recently: jest-when
import { when } from 'jest-when';
const fn = jest.fn();
when(fn).calledWith(1).mockReturnValue('yay!');
const result = fn(1);
expect(result).toEqual('yay!');
Here’s the library: https://github.com/timkindberg/jest-when