mcous / vitest-when

Stub behaviors of Vitest mock functions based on how they are called
MIT License
28 stars 3 forks source link

Include `thenResolveOnce` and `thenReturnOnce`? #14

Closed narthur closed 5 days ago

narthur commented 5 days ago

I'm migrating some code from jest-when and it would be really nice to have *Once method variants to replace .mockResolvedValueOnce and .mockReturnValueOnce.

narthur commented 5 days ago

Never mind, didn't see that this is already supported:

when(spy, { times: 1 }).calledWith('hello').thenReturn('world')