angular.js/test/service/exceptionHandlerSpec.js

24 lines
781 B
JavaScript

'use strict';
describe('$exceptionHandler', function() {
it('should log errors with single argument', function() {
module(function($provide){
$provide.service('$exceptionHandler', $ExceptionHandlerProvider);
});
inject(function($log, $exceptionHandler) {
$exceptionHandler('myError');
expect($log.error.logs.shift()).toEqual(['myError']);
});
});
it('should log errors with multiple arguments', function() {
module(function($provide){
$provide.service('$exceptionHandler', $ExceptionHandlerProvider);
});
inject(function($log, $exceptionHandler) {
$exceptionHandler('myError', 'comment');
expect($log.error.logs.shift()).toEqual(['myError', 'comment']);
});
});
});