Open jitendrasbhati opened 10 years ago
describe("ChartApp Factory Tests", function () { var $root={}; beforeEach(module('chartApp'));
it("expects GET http calls and returns mock data", inject(function ($http, $httpBackend,$rootScope,$controller) { var url = 'RNASequenceDataServlet?country=scatterplot', successCallback = jasmine.createSpy(); $scope = $rootScope.$new(); $root=$rootScope; ctrl = $controller('chartCtrl', { $scope : $scope }); // Create expectation $httpBackend.expectGET(url).respond(200, 'mock data'); // Call http service $http.get(url).success(successCallback); // callback called only after flush expect(successCallback).not.toHaveBeenCalled(); // flush response $httpBackend.flush(); // Verify expectations // Actual response is [ 'mock data', 200, Function, { method : 'GET', url : '/path/to/resource' } ] expect(successCallback.mostRecentCall.args).toContain('mock data'); expect(successCallback.mostRecentCall.args[1]).toBe(200); expect(url).toEqual('RNASequenceDataServlet?country=scatterplot'); $root.$apply(); console.log($scope.scatterplotdata); })); });
Error:-Unexpected request: GET ReadingExistingComment Expected GET RNASequenceDataServlet?country=scatterplot
It is redirecting to ReadingExistingComment servlet,though I have not given that path in url.
describe("ChartApp Factory Tests", function () {
var $root={}; beforeEach(module('chartApp'));
Error:-Unexpected request: GET ReadingExistingComment Expected GET RNASequenceDataServlet?country=scatterplot