aboutsummaryrefslogtreecommitdiffstats
path: root/test/service/exceptionHandlerSpec.js
blob: 74f37cb90b44065a13c55a5a82e2eb67c2d63160 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
'use strict';

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');

    $log.error.rethrow = false;
    $exceptionHandler('myError');
    expect($log.error.logs.shift()).toEqual(['myError']);
  });
});