From d0aff9ed029d87192f8994a504aab1655eeb34d6 Mon Sep 17 00:00:00 2001 From: Sheel Choksi Date: Thu, 24 Oct 2013 12:15:17 -0700 Subject: [PATCH] Use toThrowError instead of toThrow in places where we are expecting an error --- spec/core/matchers/toThrowErrorSpec.js | 8 ++++---- spec/core/matchers/toThrowSpec.js | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/spec/core/matchers/toThrowErrorSpec.js b/spec/core/matchers/toThrowErrorSpec.js index a218a385..17b9c93e 100644 --- a/spec/core/matchers/toThrowErrorSpec.js +++ b/spec/core/matchers/toThrowErrorSpec.js @@ -4,7 +4,7 @@ describe("toThrowError", function() { expect(function() { 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() { @@ -15,7 +15,7 @@ describe("toThrowError", function() { expect(function() { 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() { @@ -26,7 +26,7 @@ describe("toThrowError", function() { expect(function() { 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() { @@ -37,7 +37,7 @@ describe("toThrowError", function() { expect(function() { 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() { diff --git a/spec/core/matchers/toThrowSpec.js b/spec/core/matchers/toThrowSpec.js index 2c5b4b99..ce50cb95 100644 --- a/spec/core/matchers/toThrowSpec.js +++ b/spec/core/matchers/toThrowSpec.js @@ -4,7 +4,7 @@ describe("toThrow", function() { expect(function() { 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() {