Jasmine Test Issues

How to spyon an Ajax call and load response text by yourself instead of server.
here's the code with explanation.... (smile)

spyOn(Ext.Ajax, 'request').andCallFake(function (request) {
var response = {
responseText: "here is you can hardcode in the server response text",
status: 200 // here define the status code which you want 200,501,..
};

request.success = 'true';

// this callback is loading response(defined above) into the store instead of loading an actual reponse from server
// callback(options,success,reponse){ }
// options are null

request.callback(null, true, response);

});

mainList = Ext.create('Screener.store.Patients'); // creation of store will call Ajax request and from here spyon works.

//now you can check if the data in mainList is the same as what you have hardcoded in responseText