Using Leaflet, I have created a marker and want to remove the pop-up when the mouse is outside of it. This is the code for handling `mouseout` event:
marker.on('mouseout', e => this.leafletMap.closePopup());
I need help testing if the callback behaves as expected during my testing phase. To check if the event triggers on `mouseout`, I use:
expect((mockedMarker.on as jasmine.Spy).calls.argsFor(0)[0]).toEqual('mouseover');
I'm new to unit testing and struggling to find a solution online for verifying the function call. I attempted something like:
expect((mockedMarker.on as jasmine.Spy).calls.argsFor(0)[1]).toEqual(JSON.stringify(component.leafletMap.closePopup));
However, I'm unsure about my approach. Can anyone provide guidance on how to test this scenario effectively? Just to clarify, I am working with Typescript.