Service components in ngMock

Name Description
$exceptionHandler

Mock implementation of $exceptionHandler that rethrows or logs errors passed to it. See $exceptionHandlerProvider for configuration information.

$log

Mock implementation of $log that gathers all logged messages in arrays (one array per logging level). These arrays are exposed as logs property of each of the level-specific log function, e.g. for level error the array is exposed as $log.error.logs.

$interval

Mock implementation of the $interval service.

$animate

Mock implementation of the $animate service. Exposes two additional methods for testing animations.

$httpBackend

Fake HTTP backend implementation suitable for unit testing applications that use the $http service.

$timeout

This service is just a simple decorator for $timeout service that adds a "flush" and "verifyNoPendingTasks" methods.

$controller

A decorator for $controller with additional bindings parameter, useful when testing controllers of directives that use bindToController.

$componentController

A service that can be used to create instances of component controllers.

Be aware that the controller will be instantiated and attached to the scope as specified in the component definition object. That means that you must always provide a $scope object in the locals param.