Custom matchers fail to behave as expected

If they return false, that should be respected.

Submitted via @tjgrathwell

[Finish #58184156]
close #434
This commit is contained in:
Gregg Van Hove and Tim Jarratt
2013-10-03 15:13:27 -07:00
parent 6354ee17e5
commit 7e071547f5
3 changed files with 20 additions and 8 deletions

View File

@@ -153,10 +153,22 @@ describe("matchersUtil", function() {
expect(j$.matchersUtil.equals(1, 2, [tester])).toBe(true);
});
it("passes for two empty Objects", function () {
expect(j$.matchersUtil.equals({}, {})).toBe(true);
});
describe("when a custom equality matcher is installed that returns 'undefined'", function () {
var tester = function(a, b) { return jasmine.undefined; };
it("passes for two empty Objects", function () {
expect(j$.matchersUtil.equals({}, {}, [tester])).toBe(true);
});
});
it("fails for equivalents when a custom equality matcher returns false", function() {
var tester = function(a, b) { return false; };
expect(j$.matchersUtil.equals(1, 2, [tester])).toBe(false);
expect(j$.matchersUtil.equals(1, 1, [tester])).toBe(false);
});
});