You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling mockProvider, class methods are mocked, but everything else is left undefined including arrow functions.
We have gotten into the habit of using arrow functions instead of class methods for much of our logic, because of their brevity.
Is it possible to also mock arrow functions? I know I can manually provide them, but it would be nice if mockProvider could automatically mock them as jest.fn(). It seems as if by their nature of not being on the prototype that this may not be possible.
Is it bad practice to write an arrow function vs an ES6 class method?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
When calling
mockProvider
, class methods are mocked, but everything else is left undefined including arrow functions.We have gotten into the habit of using arrow functions instead of class methods for much of our logic, because of their brevity.
Example:
Beta Was this translation helpful? Give feedback.
All reactions