Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit d60fbcc

Browse files
DavidSoutherpetebacondarwin
authored andcommittedDec 23, 2014
test($exceptionHandlerProvider): call inject() to run tests
In the current angular-mocksSpec, the tests for $exceptionHandlerProvider call `module` to run tests on `$exceptionHandlerProvider.mode()`, but do not call `inject()` to pump the module definitions. Closes #10563
1 parent b193535 commit d60fbcc

File tree

1 file changed

+21
-14
lines changed

1 file changed

+21
-14
lines changed
 

‎test/ngMock/angular-mocksSpec.js

+21-14
Original file line numberDiff line numberDiff line change
@@ -588,22 +588,29 @@ describe('ngMock', function() {
588588
}));
589589

590590

591-
it('should log exceptions', module(function($exceptionHandlerProvider){
592-
$exceptionHandlerProvider.mode('log');
593-
var $exceptionHandler = $exceptionHandlerProvider.$get();
594-
$exceptionHandler('MyError');
595-
expect($exceptionHandler.errors).toEqual(['MyError']);
596-
597-
$exceptionHandler('MyError', 'comment');
598-
expect($exceptionHandler.errors[1]).toEqual(['MyError', 'comment']);
599-
}));
591+
it('should log exceptions', function() {
592+
module(function($exceptionHandlerProvider) {
593+
$exceptionHandlerProvider.mode('log');
594+
});
595+
inject(function($exceptionHandler) {
596+
$exceptionHandler('MyError');
597+
expect($exceptionHandler.errors).toEqual(['MyError']);
600598

599+
$exceptionHandler('MyError', 'comment');
600+
expect($exceptionHandler.errors[1]).toEqual(['MyError', 'comment']);
601+
});
602+
});
603+
604+
it('should throw on wrong argument', function() {
605+
module(function($exceptionHandlerProvider) {
606+
expect(function() {
607+
$exceptionHandlerProvider.mode('XXX');
608+
}).toThrow("Unknown mode 'XXX', only 'log'/'rethrow' modes are allowed!");
609+
});
610+
611+
inject(); // Trigger the tests in `module`
612+
});
601613

602-
it('should throw on wrong argument', module(function($exceptionHandlerProvider) {
603-
expect(function() {
604-
$exceptionHandlerProvider.mode('XXX');
605-
}).toThrow("Unknown mode 'XXX', only 'log'/'rethrow' modes are allowed!");
606-
}));
607614
});
608615

609616

0 commit comments

Comments
 (0)
This repository has been archived.