fix(testing): remove the toThrowErrorWith matcher (jasmine has toThrowError)

BREAKING CHANGE:

Before:

    expect(...).toThrowErrorWith(msg);

After:

    expect(...).toThrowError(msg);
This commit is contained in:
Victor Berchet
2016-06-22 14:58:57 -07:00
parent 6420f75320
commit e1e5c40ef7
17 changed files with 86 additions and 162 deletions

View File

@ -70,24 +70,6 @@ export interface NgMatchers extends jasmine.Matchers {
*/
toContainError(expected: any): boolean;
/**
* Expect a function to throw an error with the given error text when executed.
*
* ## Example
*
* {@example testing/ts/matchers.ts region='toThrowErrorWith'}
*/
toThrowErrorWith(expectedMessage: any): boolean;
/**
* Expect a string to match the given regular expression.
*
* ## Example
*
* {@example testing/ts/matchers.ts region='toMatchPattern'}
*/
toMatchPattern(expectedMessage: any): boolean;
/**
* Invert the matchers.
*/
@ -233,26 +215,6 @@ _global.beforeEach(function() {
};
},
toThrowErrorWith: function() {
return {
compare: function(actual: any /** TODO #???? */, expectedText: any /** TODO #???? */) {
try {
actual();
return {
pass: false,
get message() { return 'Was expected to throw, but did not throw'; }
};
} catch (e) {
var errorMessage = e.toString();
return {
pass: errorMessage.indexOf(expectedText) > -1,
get message() { return 'Expected ' + errorMessage + ' to contain ' + expectedText; }
};
}
}
};
},
toImplement: function() {
return {
compare: function(