Unit testing Ajax requests with Mocha

Tags:

Ajax requests can easily go wrong. You can’t guarantee the connection and the server always work correctly. They are also often used to send user input to the server and back, so it’s vital the data is handled correctly. But testing them can be tricky. It’s asynchronous, and also a good unit test must be isolated, so how can we …