ngMock.$httpBackend.expectPATCH()

expectPATCH(url, [data], [headers], [keys]); Creates a new request expectation for PATCH requests. For more info see expect(). 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. data (optional) stringRegExpfunction(string)Object HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format

ngMock.$httpBackend.expectJSONP()

expectJSONP(url, [keys]); Creates a new request expectation for JSONP requests. For more info see expect(). Parameters Param Type Details url stringRegExpfunction(string) HTTP url or function that receives an 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 above. Returns requestHandler Returns an object with respond method that controls how a matched request is handled. You c

ngMock.$httpBackend.expectHEAD()

expectHEAD(url, [headers], [keys]); Creates a new request expectation for HEAD requests. For more info see expect(). 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) Object HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described above. Returns requestHandler Returns an object with respond method

ngMock.$httpBackend.expectGET()

expectGET(url, [headers], [keys]); Creates a new request expectation for GET requests. For more info see expect(). 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) Object HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described above. Returns requestHandler Returns an object with respond method t

ngMock.$httpBackend.expectDELETE()

expectDELETE(url, [headers], [keys]); Creates a new request expectation for DELETE requests. For more info see expect(). 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) Object HTTP headers. keys (optional) Array Array of keys to assign to regex matches in request url described above. Returns requestHandler Returns an object with respond me

ngMock.$httpBackend.expect()

expect(method, url, [data], [headers], [keys]); Creates a new request expectation. 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) stringRegExpfunction(string)Object HTTP request body or function that receives data string and returns true if the data is as expected, or Object if request body is in JSON format. headers

ngMock.$httpBackend

service in module ngMock Fake HTTP backend implementation suitable for unit testing applications that use the $http service. Note: For fake HTTP backend implementation suitable for end-to-end testing or backend-less development please see e2e $httpBackend mock. During unit testing, we want our unit tests to run quickly and have no external dependencies so we donĂ¢t want to send XHR or JSONP requests to a real server. All we really need is to verify whether a certain request has been sent or

ngMock.$exceptionHandlerProvider.mode()

mode(mode); Sets the logging mode. Parameters Param Type Details mode string Mode of operation, defaults to rethrow. log: Sometimes it is desirable to test that an error is thrown, for this case the logmode stores an array of errors in `$exceptionHandler.errors`, to allow later assertion of them. See assertEmpty() and reset() rethrow: If any errors are passed to the handler in tests, it typically means that thereis a bug in the application or test, so this mock will make these tests

ngMock.$exceptionHandlerProvider

$exceptionHandler provider in module ngMock Configures the mock implementation of $exceptionHandler to rethrow or to log errors passed to the $exceptionHandler. Methods mode(mode); Sets the logging mode. Parameters Param Type Details mode string Mode of operation, defaults to rethrow. log: Sometimes it is desirable to test that an error is thrown, for this case the logmode stores an array of errors in `$exceptionHandler.errors`, to allow later assertion of them. See assertEmpt

ngMock.$animate

service in module ngMock Mock implementation of the $animate service. Exposes two additional methods for testing animations. Methods closeAndFlush(); This method will close all pending animations (both Javascript and CSS) and it will also flush any remaining animation frames and/or callbacks. flush(); This method is used to flush the pending callbacks and animation frames to either start an animation or conclude an animation. Note that this will not actually close an actively runni