Merge branch 'custom-object-formatters' into cof-merge-candidate
This commit is contained in:
@@ -2584,4 +2584,33 @@ describe("Env integration", function() {
|
||||
|
||||
env.execute();
|
||||
});
|
||||
|
||||
it("supports asymmetric equality testers that take a matchersUtil", function(done) {
|
||||
var env = new jasmineUnderTest.Env();
|
||||
|
||||
env.it("spec using custom asymmetric equality tester", function() {
|
||||
var customEqualityFn = function(a, b) {
|
||||
if (a === 2 && b === "two") {
|
||||
return true;
|
||||
}
|
||||
};
|
||||
var arrayWithFirstElement = function(sample) {
|
||||
return {
|
||||
asymmetricMatch: function (actual, matchersUtil) {
|
||||
return matchersUtil.equals(sample, actual[0]);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
env.addCustomEqualityTester(customEqualityFn);
|
||||
env.expect(["two"]).toEqual(arrayWithFirstElement(2));
|
||||
});
|
||||
|
||||
var specExpectations = function(result) {
|
||||
expect(result.status).toEqual('passed');
|
||||
};
|
||||
|
||||
env.addReporter({ specDone: specExpectations, jasmineDone: done });
|
||||
env.execute();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user