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:
@@ -10,10 +10,8 @@ describe("Custom Matchers (Integration)", function() {
|
||||
env.it('spec defining a custom matcher', function() {
|
||||
env.addMatchers({
|
||||
matcherForSpec: function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
return { pass: false, message: "matcherForSpec: actual: " + actual + "; expected: " + expected };
|
||||
}
|
||||
return function(actual, expected) {
|
||||
return { pass: false, message: "matcherForSpec: actual: " + actual + "; expected: " + expected };
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -40,7 +38,7 @@ describe("Custom Matchers (Integration)", function() {
|
||||
it("passes the spec if the custom matcher passes", function(done) {
|
||||
env.addMatchers({
|
||||
toBeReal: function() {
|
||||
return { compare: function() { return { pass: true }; } };
|
||||
return function() { return { pass: true }; };
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,10 +57,8 @@ describe("Custom Matchers (Integration)", function() {
|
||||
it("generates messages with the same rules as built in matchers absent a custom message", function(done) {
|
||||
env.addMatchers({
|
||||
toBeReal: function() {
|
||||
return {
|
||||
compare: function() {
|
||||
return { pass: false };
|
||||
}
|
||||
return function() {
|
||||
return { pass: false };
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -83,7 +79,7 @@ describe("Custom Matchers (Integration)", function() {
|
||||
var argumentSpy = jasmine.createSpy("argument spy").and.returnValue({ pass: true });
|
||||
env.addMatchers({
|
||||
toBeReal: function() {
|
||||
return { compare: argumentSpy };
|
||||
return argumentSpy;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -104,7 +100,7 @@ describe("Custom Matchers (Integration)", function() {
|
||||
});
|
||||
|
||||
it("passes the jasmine utility and current equality matchers to the expectation factory", function(done) {
|
||||
var matcherFactory = function() { return { compare: function() { return {pass: true}; }}; },
|
||||
var matcherFactory = function() { return function() { return { pass: true }; }; },
|
||||
argumentSpy = jasmine.createSpy("argument spy").and.returnValue(matcherFactory),
|
||||
customEqualityFn = function() { return true; };
|
||||
|
||||
|
||||
Reference in New Issue
Block a user