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

Commit b43fa3b

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 521c12c commit b43fa3b

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
@@ -592,22 +592,29 @@ describe('ngMock', function() {
592592
}));
593593

594594

595-
it('should log exceptions', module(function($exceptionHandlerProvider) {
596-
$exceptionHandlerProvider.mode('log');
597-
var $exceptionHandler = $exceptionHandlerProvider.$get();
598-
$exceptionHandler('MyError');
599-
expect($exceptionHandler.errors).toEqual(['MyError']);
600-
601-
$exceptionHandler('MyError', 'comment');
602-
expect($exceptionHandler.errors[1]).toEqual(['MyError', 'comment']);
603-
}));
595+
it('should log exceptions', function() {
596+
module(function($exceptionHandlerProvider) {
597+
$exceptionHandlerProvider.mode('log');
598+
});
599+
inject(function($exceptionHandler) {
600+
$exceptionHandler('MyError');
601+
expect($exceptionHandler.errors).toEqual(['MyError']);
604602

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

606-
it('should throw on wrong argument', module(function($exceptionHandlerProvider) {
607-
expect(function() {
608-
$exceptionHandlerProvider.mode('XXX');
609-
}).toThrow("Unknown mode 'XXX', only 'log'/'rethrow' modes are allowed!");
610-
}));
611618
});
612619

613620

0 commit comments

Comments
 (0)
This repository has been archived.