From 475aacbfbbbe598eb4aa4223deac3ff0683ba66f Mon Sep 17 00:00:00 2001 From: "Davis W. Frank" Date: Wed, 29 May 2013 20:16:12 -0700 Subject: [PATCH] [Finishes #50607273] - added specs to cover the cases from GitHub issue #371 --- spec/core/matchersSpec.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/spec/core/matchersSpec.js b/spec/core/matchersSpec.js index 88a30acb..4b88153d 100644 --- a/spec/core/matchersSpec.js +++ b/spec/core/matchersSpec.js @@ -596,5 +596,31 @@ describe("Matchers", function() { expect(result.pass).toBe(false); expect(result.message).toEqual("Expected function to throw an exception matching /short/."); }); + + it("passes if the actual throws an exception with an undefined message", function() { + var matcher = j$.matchers.toThrow(), + fn = function() { + throw void 0; + }, + result; + + result = matcher.compare(fn); + + expect(result.pass).toBe(true); + expect(result.message).toEqual("Expected function not to throw an exception."); + }); + + it("passes if the actual throws an exception with an empty message", function() { + var matcher = j$.matchers.toThrow(), + fn = function() { + throw ""; + }, + result; + + result = matcher.compare(fn); + + expect(result.pass).toBe(true); + expect(result.message).toEqual("Expected function not to throw an exception."); + }); }); }); \ No newline at end of file