How can I write a QUnit test for this:
function doSomethingWithAjax() {
$.ajax({
url: '/GetHelloWorld',
success: function(data) { $("#responseFromServer").text(data); },
});
}
Mockjax+qunit requires a start() call in the ajax complete() method.
The jasmine-ajax library allows you to define mock responses for all ajax calls without touching the calls themselves.
This question has a few years and for the new versions of jQuery and Jasmine have changed a bit.
If you don't want to use jasmine-ajax you can try Michael Falaga's approach