aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/exceptionHandlerSpec.js
blob: 593490652579ea135868dc3a5ebc17c27fece4e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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']);
  });
});