I use a Leaflet and I create a marker on it. Once the mouse exited this marker, I would like to remove the popup that I show on the mouseenter :
marker.on('mouseout', e => this.leafletMap.closePopup());
In my testing, I would like to know if there is a callback that I expect.
I am already testing if an event occurs when the mouse is displayed with
expect((mockedMarker.on as jasmine.Spy).calls.argsFor(0)[0]).toEqual('mouseover');
Any ideas on how to do this?
I tried something like this
expect((mockedMarker.on as jasmine.Spy).calls.argsFor(0)[1]).toEqual(JSON.stringify(component.leafletMap.closePopup));
But I don’t know what I am doing (I am new to unit testing) and I can’t find a solution on the Internet because I really don’t know what to call this test.
I must indicate that I am working in Typescript .
unit-testing angular typescript jasmine leaflet
trichetriche
source share