I'm using Jest and Typescript. I have a async function that returns nothing (void). How do I mock returning void? I tried the below
const myMockFn = jest.fn().mockImplementationOnce(() => Promise.resolve(void));
jest.mock('../config', () => ({
setup: async () =>
myMockFn(),
}));
but I get the compilation error
Expression expected.
related to "Promise.resolve(void)".
Promise.resolve()
instead ofPromise.resolve(void)
– Mcgaryvoid
operator – Swiercz