Remove an extra layer of wrapping for matchers/custom matchers

Helps reduce how nested custom matchers have to be for users as well as
Jasmine internal matchers

[#59161378]
This commit is contained in:
Sheel Choksi
2013-10-19 22:46:19 -07:00
parent 5f429fcb37
commit 39d7ebf28e
37 changed files with 437 additions and 494 deletions

View File

@@ -1,35 +1,35 @@
describe("toBeNaN", function() {
it("passes for NaN with a custom .not fail", function() {
var matcher = j$.matchers.toBeNaN(),
var matcherComparator = j$.matchers.toBeNaN(),
result;
result = matcher.compare(Number.NaN);
result = matcherComparator(Number.NaN);
expect(result.pass).toBe(true);
expect(result.message).toEqual("Expected actual not to be NaN.");
});
it("fails for anything not a NaN", function() {
var matcher = j$.matchers.toBeNaN();
var matcherComparator = j$.matchers.toBeNaN();
result = matcher.compare(1);
result = matcherComparator(1);
expect(result.pass).toBe(false);
result = matcher.compare(null);
result = matcherComparator(null);
expect(result.pass).toBe(false);
result = matcher.compare(void 0);
result = matcherComparator(void 0);
expect(result.pass).toBe(false);
result = matcher.compare('');
result = matcherComparator('');
expect(result.pass).toBe(false);
result = matcher.compare(Number.POSITIVE_INFINITY);
result = matcherComparator(Number.POSITIVE_INFINITY);
expect(result.pass).toBe(false);
});
it("has a custom message on failure", function() {
var matcher = j$.matchers.toBeNaN(),
result = matcher.compare(0);
var matcherComparator = j$.matchers.toBeNaN(),
result = matcherComparator(0);
expect(result.message).toEqual("Expected 0 to be NaN.");
});