exceptionHandlerSpec.js 783 Bytes
Newer Older
nextime's avatar
nextime committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
'use strict';

describe('$exceptionHandler', function() {
    it('should log errors with single argument', function() {
      module(function($provide){
        $provide.provider('$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.provider('$exceptionHandler', $ExceptionHandlerProvider);
      });
      inject(function($log, $exceptionHandler) {
        $exceptionHandler('myError', 'comment');
        expect($log.error.logs.shift()).toEqual(['myError', 'comment']);
      });
    });
});