Closed DurchblickerFabian closed 4 months ago
Just an addition: This is probably not very easily solve-able, since introducing spies would limit this library to a specific testing framework if not using a platform agnostic spy/mock library like sinon. I don't know if that would a great solution, basically forcing users of this library to use a specific spy/mock library. Maybe an addition in the README how to possibly set this up by one-self for example with Jest and/or sinon would be great.
After re-evaluation, a user of this library could just register a spy and check if the spy is called. (e.g. const spy = jest.spyOn(mockRouter, 'reload');
and expect(spy).toHaveBeenCalled();
respectively)
Closing this.
It would be useful if one could use the following snippet to check whether reload was called or not:
expect(mockRouter.reload).toHaveBeenCalled();
. Right now, this is not possible ("Matcher error: received value must be a mock or spy function").In my opinion reload does not need any functionality, but if possible, it would be nice to have the possibility to check if it has been called. (Maybe also applicable for the other functions like push, because right now they are all raw functions)