Jasmine Test Issues
How to spyon an Ajax call and load response text by yourself instead of server.
here's the code with explanation....Â
spyOn(Ext.Ajax, 'request').andCallFake(function (request) { request.success = 'true'; // this callback is loading response(defined above) into the store instead of loading an actual reponse from server 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 |
---|