I have a web app that needs to check if the user is connected to the internet. In the implementation, the check() function promises to true if an ajax ping to a known endpoint succeeds and false if the ajax call fails in any way.
In Jasmine, I can use request.respondWith({status:400, etc}) to simulate a failure, but I can't work out how to simulate the more fundamental error of the call not being made at all.
In practice, browsers seem to 'return' a status code 0 and readyState 4 when the call could not even be made.
How should I approach this in my Jasmine tests?