-
-
Notifications
You must be signed in to change notification settings - Fork 21
Description
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe it
In jest-mock-extended there is a mockFn that can be used as a replacement for jest.fn. It produces mocks that have a .calledWith interface for more fluent mocking, i.e. thisMock.doSomething.calledWith(123).mockReturnValue(456). Currently the mocks created by automock are vanilla jest mocks. It would be really nice to be able to get mocks with calledWith via the TestBed unitRef.get interface (with type safey).
Describe the solution you'd like
jest-mock-extended's MockProxy type (which includes calledWith) appears be a sub type of vanilla jest mocks, so it might be plausible to adopt it for all of automock's jest mocking without breaking changes. But it would probably be cleaner to add a "mocker" argument to TestBed (although the generic typing required for this might get ugly).
What is the motivation / use case for changing the behavior?
Gain the advantages of both automock and jest-mock-extended without loosing the cleanness of automock's interfaces.