aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/AngularSpec.js7
-rw-r--r--test/auto/injectorSpec.js25
2 files changed, 21 insertions, 11 deletions
diff --git a/test/AngularSpec.js b/test/AngularSpec.js
index 9686ffd6..8fda7a65 100644
--- a/test/AngularSpec.js
+++ b/test/AngularSpec.js
@@ -605,7 +605,9 @@ describe('angular', function() {
expect(function() {
angularInit(appElement, bootstrap);
- }).toThrow("[$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
+ }).toThrowMatching(
+ /\[\$injector:modulerr] Failed to instantiate module doesntexist due to:\n.*\[\$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it\./
+ );
});
});
@@ -749,7 +751,8 @@ describe('angular', function() {
expect(function() {
angular.bootstrap(element, ['doesntexist']);
- }).toThrow("[$injector:nomod] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it.");
+ }).toThrowMatching(
+ /\[\$injector:modulerr\] Failed to instantiate module doesntexist due to:\n.*\[\$injector:nomod\] Module 'doesntexist' is not available! You either misspelled the module name or forgot to load it\./);
expect(element.html()).toBe('{{1+2}}');
dealoc(element);
diff --git a/test/auto/injectorSpec.js b/test/auto/injectorSpec.js
index 4f70fb27..2c485655 100644
--- a/test/auto/injectorSpec.js
+++ b/test/auto/injectorSpec.js
@@ -268,8 +268,9 @@ describe('injector', function() {
it('should error on invalid module name', function() {
expect(function() {
createInjector(['IDontExist'], {});
- }).toThrow("[$injector:nomod] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it.");
-
+ }).toThrowMatching(
+ /\[\$injector:modulerr\].+\n.*\[\$injector:nomod] Module 'IDontExist' is not available! You either misspelled the module name or forgot to load it/
+ );
});
@@ -552,7 +553,7 @@ describe('injector', function() {
createInjector([
{}
], {});
- }).toThrow("[ng:areq] Argument 'module' is not a function, got Object");
+ }).toThrowMatching(/\[\$injector:modulerr\] Failed to instantiate module {} due to:\n.*\[ng\:areq] Argument 'module' is not a function, got Object/);
});
@@ -561,15 +562,17 @@ describe('injector', function() {
createInjector([function() {
throw 'MyError';
}], {});
- }).toThrow('MyError');
+ }).toThrowMatching(/\[\$injector:modulerr\] Failed to instantiate module .+ due to:\n.*MyError/);
});
it('should decorate the missing service error with module name', function() {
angular.module('TestModule', [], function(xyzzy) {});
expect(function() {
- createInjector(['TestModule']);
- }).toThrow('[$injector:unpr] Unknown provider: xyzzy from TestModule');
+ createInjector(['TestModule' ]);
+ }).toThrowMatching(
+ /\[\$injector:modulerr\] Failed to instantiate module TestModule due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ );
});
@@ -577,7 +580,9 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([myModule]);
- }).toThrow('[$injector:unpr] Unknown provider: xyzzy from ' + myModule);
+ }).toThrowMatching(
+ /\[\$injector:modulerr\] Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ );
});
@@ -585,7 +590,9 @@ describe('injector', function() {
function myModule(xyzzy){}
expect(function() {
createInjector([['xyzzy', myModule]]);
- }).toThrow('[$injector:unpr] Unknown provider: xyzzy from ' + myModule);
+ }).toThrowMatching(
+ /\[\$injector:modulerr\] Failed to instantiate module function myModule\(xyzzy\) due to:\n.*\[\$injector:unpr] Unknown provider: xyzzy/
+ );
});
@@ -801,7 +808,7 @@ describe('injector', function() {
createInjector([function($provide) {
$provide.value('name', 'angular')
}, instanceLookupInModule]);
- }).toThrow('[$injector:unpr] Unknown provider: name from ' + String(instanceLookupInModule));
+ }).toThrowMatching(/\[\$injector:unpr] Unknown provider: name/);
});
});
});