is there a way to stub a function using jest API? I\'m used to working with sinon stub, where I can write unit-tests with stubs for any function call coming out of my tested un
Jest provides jest.fn(), which has some basic mocking and stubbing functionality.
If you're experienced and comfortable with sinon you could still create Jest-based tests which use sinon test doubles. However you'll lose the convenience of built in Jest matchers such as expect(myStubFunction).toHaveBeenCalled()
.