Check the exception message in all Realm tests which assert an exception is thrown
This commit is contained in:
parent
4ad75c9546
commit
53ca09839e
|
@ -120,6 +120,23 @@ module.exports = {
|
|||
}
|
||||
},
|
||||
|
||||
assertThrowsContaining: function(func, expectedMessage) {
|
||||
var caught = false;
|
||||
try {
|
||||
func();
|
||||
}
|
||||
catch (e) {
|
||||
caught = true;
|
||||
if (!e.message.includes(expectedMessage)) {
|
||||
throw new TestFailureError(`Expected exception "${expectedMessage}" not thrown - instead caught: "${e}"`);
|
||||
}
|
||||
}
|
||||
|
||||
if (!caught) {
|
||||
throw new TestFailureError(`Expected exception "${expectedMessage}" not thrown`);
|
||||
}
|
||||
},
|
||||
|
||||
assertTrue: function(condition, errorMessage) {
|
||||
if (!condition) {
|
||||
throw new TestFailureError(errorMessage || `Condition ${condition} expected to be true`);
|
||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue