Use toThrowError instead of toThrow in places where we are expecting an error
This commit is contained in:
@@ -4,7 +4,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
matcherComparator({});
|
matcherComparator({});
|
||||||
}).toThrow(new Error("Actual is not a Function")); // TODO: this needs to change for self-test
|
}).toThrowError("Actual is not a Function");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws an error when the expected is not an Error, string, or RegExp", function() {
|
it("throws an error when the expected is not an Error, string, or RegExp", function() {
|
||||||
@@ -15,7 +15,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
matcherComparator(fn, 1);
|
matcherComparator(fn, 1);
|
||||||
}).toThrow(new Error("Expected is not an Error, string, or RegExp.")); // TODO: this needs to change for self-test
|
}).toThrowError("Expected is not an Error, string, or RegExp.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws an error when the expected error type is not an Error", function() {
|
it("throws an error when the expected error type is not an Error", function() {
|
||||||
@@ -26,7 +26,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
matcherComparator(fn, void 0, "foo");
|
matcherComparator(fn, void 0, "foo");
|
||||||
}).toThrow(new Error("Expected error type is not an Error.")); // TODO: this needs to change for self-test
|
}).toThrowError("Expected error type is not an Error.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws an error when the expected error message is not a string or RegExp", function() {
|
it("throws an error when the expected error message is not a string or RegExp", function() {
|
||||||
@@ -37,7 +37,7 @@ describe("toThrowError", function() {
|
|||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
matcherComparator(fn, Error, 1);
|
matcherComparator(fn, Error, 1);
|
||||||
}).toThrow(new Error("Expected error message is not a string or RegExp.")); // TODO: this needs to change for self-test
|
}).toThrowError("Expected error message is not a string or RegExp.");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails if actual does not throw at all", function() {
|
it("fails if actual does not throw at all", function() {
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe("toThrow", function() {
|
|||||||
|
|
||||||
expect(function() {
|
expect(function() {
|
||||||
matcherComparator({});
|
matcherComparator({});
|
||||||
}).toThrow(new Error("Actual is not a Function")); // TODO: this needs to change for self-test
|
}).toThrowError("Actual is not a Function");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("fails if actual does not throw", function() {
|
it("fails if actual does not throw", function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user