[Finishes #50607273] - added specs to cover the cases from GitHub issue #371

This commit is contained in:
Davis W. Frank
2013-05-29 20:16:12 -07:00
parent 8303c79f26
commit 475aacbfbb

View File

@@ -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.");
});
});
});