angular.js/test/service/exceptionHandlerSpec.js

24 lines
545 B
JavaScript
Raw Normal View History

describe('$exceptionHandler', function() {
var scope;
beforeEach(function(){
scope = angular.scope();
});
afterEach(function(){
dealoc(scope);
});
it('should log errors', function(){
var scope = createScope({}, {$exceptionHandler: $exceptionHandlerFactory},
{$log: $logMock}),
$log = scope.$service('$log'),
$exceptionHandler = scope.$service('$exceptionHandler');
$exceptionHandler('myError');
expect($log.error.logs.shift()).toEqual(['myError']);
});
});