Hacker News new | ask | show | jobs
by griffindy 4877 days ago
I've always liked testing ajax requests with sinon [1]. It injects its own version of an XMLHttpRequest object to keep track of all requests, and you can also send specific responses to test success and failure handling.

[1] http://sinonjs.org/docs/#useFakeXMLHttpRequest