ngMockE2E.$httpBackend.whenGET()

whenGET(url, [headers], [keys]); Creates a new backend definition for GET requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. headers (optional) Objectfunction(Object) HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described on $httpBackend mock. Returns requestHandler Returns an ob

ngMockE2E.$httpBackend.whenJSONP()

whenJSONP(url, [keys]); Creates a new backend definition for JSONP requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. keys (optional) Array Array of keys to assign to regex matches in request url described on $httpBackend mock. Returns requestHandler Returns an object with respond and passThrough methods that control how a matched

ngMockE2E.$httpBackend.whenHEAD()

whenHEAD(url, [headers], [keys]); Creates a new backend definition for HEAD requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. headers (optional) Objectfunction(Object) HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described on $httpBackend mock. Returns requestHandler Returns an

ngMockE2E.$httpBackend.when()

when(method, url, [data], [headers], [keys]); Creates a new backend definition. Parameters Param Type Details method string HTTP method. url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. data (optional) stringRegExp HTTP request body. headers (optional) Objectfunction(Object) HTTP headers or function that receives http header object and returns true if the headers match the current defin

ngMockE2E.$httpBackend.whenDELETE()

whenDELETE(url, [headers], [keys]); Creates a new backend definition for DELETE requests. For more info see when(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives a url and returns true if the url matches the current definition. headers (optional) Objectfunction(Object) HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described on $httpBackend mock. Returns requestHandler Returns

ngMockE2E.$httpBackend

service in module ngMockE2E Fake HTTP backend implementation suitable for end-to-end testing or backend-less development of applications that use the $http service. Note: For fake http backend implementation suitable for unit testing please see unit-testing $httpBackend mock. This implementation can be used to respond with static or dynamic responses via the when api and its shortcuts (whenGET, whenPOST, etc) and optionally pass through requests to the real $httpBackend for specific reques

ngMockE2E

Installation First include angular-mocks.js in your HTML: <script src="angular.js"> <script src="angular-mocks.js"> You can download this file from the following places: Google CDN e.g. //ajax.googleapis.com/ajax/libs/angularjs/X.Y.Z/angular-mocks.js Bower e.g. bower install angular-mocks@X.Y.Z code.angularjs.org e.g. "//code.angularjs.org/X.Y.Z/angular-mocks.js" where X.Y.Z is the AngularJS version you are running. Then load the module in your application by adding it as a

ngMock.provider

Name Description $exceptionHandlerProvider Configures the mock implementation of $exceptionHandler to rethrow or to log errors passed to the $exceptionHandler.

ngMock.object

Name Description angular.mock Namespace from 'angular-mocks.js' which contains testing related code.

ngMock.type

Name Description angular.mock.TzDate NOTE: this is not an injectable instance, just a globally available mock class of Date. $rootScope.Scope Scope type decorated with helper methods useful for testing. These methods are automatically available on any Scope instance when ngMock module is loaded.