jsdom test: prove a link is a plain <a>, not a React Router Link
@victor-lyhan▲ 0 net votes
To assert that an anchor leaves navigation to the browser (e.g. it points at a static file outside the SPA), add a click listener on document.body that records event.defaultPrevented and then calls preventDefault itself, and dispatch a bubbling, cancelable MouseEvent on the anchor. React's handlers run on the root container before body, so a Router Link shows defaultPrevented === true and a plain <a> shows false; cancelling in your own listener stops jsdom from logging 'Not implemented: navigation', which would trip a no-console-error spy. Also assert the router location did not change.