aboutsummaryrefslogtreecommitdiffstats
path: root/test/auto/injectorSpec.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/auto/injectorSpec.js')
-rw-r--r--test/auto/injectorSpec.js39
1 files changed, 19 insertions, 20 deletions
diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js
index 2c485655..efed2aa4 100644
--- a/test/auto/injectorSpec.js
+++ b/test/auto/injectorSpec.js
@@ -70,7 +70,7 @@ describe('injector', function() {
it('should provide useful message if no provider', function() {
expect(function() {
injector.get('idontexist');
- }).toThrow("[$injector:unpr] Unknown provider: idontexistProvider <- idontexist");
+ }).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist");
});
@@ -79,7 +79,7 @@ describe('injector', function() {
providers('b', function(a) {return 2;});
expect(function() {
injector.get('b');
- }).toThrow("[$injector:unpr] Unknown provider: idontexistProvider <- idontexist <- a <- b");
+ }).toThrowMinErr("$injector", "unpr", "Unknown provider: idontexistProvider <- idontexist <- a <- b");
});
@@ -127,10 +127,10 @@ describe('injector', function() {
it('should fail with errors if not function or array', function() {
expect(function() {
injector.invoke({});
- }).toThrow("[ng:areq] Argument 'fn' is not a function, got Object");
+ }).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got Object");
expect(function() {
injector.invoke(['a', 123], {});
- }).toThrow("[ng:areq] Argument 'fn' is not a function, got number");
+ }).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got number");
});
});
@@ -268,9 +268,8 @@ describe('injector', function() {
it('should error on invalid module name', function() {
expect(function() {
createInjector(['IDontExist'], {});
- }).toThrowMatching(
- /\[\$injector:modulerr\].+\n.*\[\$injector:nomod] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it/
- );
+ }).toThrowMinErr('$injector', 'modulerr',
+ /\[\$injector:nomod\] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it/);
});
@@ -553,7 +552,7 @@ describe('injector', function() {
createInjector([
{}
], {});
- }).toThrowMatching(/\[\$injector:modulerr\] Failed to instantiate module {} due to:\n.*\[ng\:areq] Argument 'module' is not a function, got Object/);
+ }).toThrowMinErr('$injector', 'modulerr', /Failed to instantiate module \{\} due to:\n.*\[ng:areq\] Argument 'module' is not a function, got Object/);
});
@@ -562,7 +561,7 @@ describe('injector', function() {
createInjector([function() {
throw 'MyError';
}], {});
- }).toThrowMatching(/\[\$injector:modulerr\] Failed to instantiate module .+ due to:\n.*MyError/);
+ }).toThrowMinErr('$injector', 'modulerr', /Failed to instantiate module .+ due to:\n.*MyError/);
});
@@ -570,8 +569,8 @@ describe('injector', function() {
angular.module('TestModule', [], function(xyzzy) {});
expect(function() {
createInjector(['TestModule' ]);
- }).toThrowMatching(
- /\[\$injector:modulerr\] Failed to instantiate module TestModule due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ }).toThrowMinErr(
+ '$injector', 'modulerr', /Failed to instantiate module TestModule due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
);
});
@@ -580,8 +579,8 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([myModule]);
- }).toThrowMatching(
- /\[\$injector:modulerr\] Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ }).toThrowMinErr(
+ '$injector', 'modulerr', /Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
);
});
@@ -590,8 +589,8 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([['xyzzy', myModule]]);
- }).toThrowMatching(
- /\[\$injector:modulerr\] Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ }).toThrowMinErr(
+ '$injector', 'modulerr', /Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
);
});
@@ -602,7 +601,7 @@ describe('injector', function() {
$provide.factory('service', function(service){});
return function(service) {}
}])
- }).toThrow("[$injector:cdep] Circular dependency found: service");
+ }).toThrowMinErr('$injector', 'cdep', 'Circular dependency found: service');
});
@@ -613,7 +612,7 @@ describe('injector', function() {
$provide.factory('b', function(a){});
return function(a) {}
}])
- }).toThrow('[$injector:cdep] Circular dependency found: b <- a');
+ }).toThrowMinErr('$injector', 'cdep', 'Circular dependency found: b <- a');
});
});
});
@@ -703,7 +702,7 @@ describe('injector', function() {
it('should throw usefull error on wrong argument type]', function() {
expect(function() {
$injector.invoke({});
- }).toThrow("[ng:areq] Argument 'fn' is not a function, got Object");
+ }).toThrowMinErr("ng", "areq", "Argument 'fn' is not a function, got Object");
});
});
@@ -790,7 +789,7 @@ describe('injector', function() {
}]);
expect(function() {
$injector.get('nameProvider');
- }).toThrow("[$injector:unpr] Unknown provider: nameProviderProvider <- nameProvider");
+ }).toThrowMinErr("$injector", "unpr", "Unknown provider: nameProviderProvider <- nameProvider");
});
@@ -798,7 +797,7 @@ describe('injector', function() {
var $injector = createInjector([]);
expect(function() {
$injector.get('$provide').value('a', 'b');
- }).toThrow("[$injector:unpr] Unknown provider: $provideProvider <- $provide");
+ }).toThrowMinErr("$injector", "unpr", "Unknown provider: $provideProvider <- $provide");
});