Revert removal of compare nesting
Since we want the user to be able to pass a negative comparison function, the extra layer of wrapping is now needed
This commit is contained in:
@@ -1,33 +1,33 @@
|
||||
describe("toMatch", function() {
|
||||
it("passes when RegExps are equivalent", function() {
|
||||
var matcherComparator = j$.matchers.toMatch(),
|
||||
var matcher = j$.matchers.toMatch(),
|
||||
result;
|
||||
|
||||
result = matcherComparator(/foo/, /foo/);
|
||||
result = matcher.compare(/foo/, /foo/);
|
||||
expect(result.pass).toBe(true);
|
||||
});
|
||||
|
||||
it("fails when RegExps are not equivalent", function() {
|
||||
var matcherComparator = j$.matchers.toMatch(),
|
||||
var matcher = j$.matchers.toMatch(),
|
||||
result;
|
||||
|
||||
result = matcherComparator(/bar/, /foo/);
|
||||
result = matcher.compare(/bar/, /foo/);
|
||||
expect(result.pass).toBe(false);
|
||||
});
|
||||
|
||||
it("passes when the actual matches the expected string as a pattern", function() {
|
||||
var matcherComparator = j$.matchers.toMatch(),
|
||||
var matcher = j$.matchers.toMatch(),
|
||||
result;
|
||||
|
||||
result = matcherComparator('foosball', 'foo');
|
||||
result = matcher.compare('foosball', 'foo');
|
||||
expect(result.pass).toBe(true);
|
||||
});
|
||||
|
||||
it("fails when the actual matches the expected string as a pattern", function() {
|
||||
var matcherComparator = j$.matchers.toMatch(),
|
||||
var matcher = j$.matchers.toMatch(),
|
||||
result;
|
||||
|
||||
result = matcherComparator('bar', 'foo');
|
||||
result = matcher.compare('bar', 'foo');
|
||||
expect(result.pass).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user