Fixed diffs involving jasmine.objectContaining

This commit is contained in:
Steve Gravrock
2020-02-11 16:25:53 -08:00
parent c2ada1af95
commit 3be797c8d8
8 changed files with 62 additions and 55 deletions

View File

@@ -125,7 +125,8 @@ describe("ObjectContaining", function() {
describe("when other is not an object", function() {
it("sets self to jasmineToString()", function () {
var containing = new jasmineUnderTest.ObjectContaining({}),
result = containing.valuesForDiff_('a');
pp = jasmineUnderTest.makePrettyPrinter(),
result = containing.valuesForDiff_('a', pp);
expect(result).toEqual({
self: '<jasmine.objectContaining(Object({ }))>',

View File

@@ -40,12 +40,4 @@ describe('ObjectPath', function() {
expect(path.toString()).toEqual('$.foo');
expect(root.toString()).toEqual('');
});
describe('#dereference', function() {
it('returns the value corresponding to the path', function () {
var path = new ObjectPath().add('foo').add(1).add('bar');
var obj = {foo: ['', {bar: 42}]};
expect(path.dereference(obj)).toEqual(42);
});
});
});

View File

@@ -429,10 +429,10 @@ describe("toEqual", function() {
expect(compareEquals(actual, expected).message).toEqual(message);
});
it("reports mismatches involving objectContaining", function() {
it("reports mismatches involving objectContaining and an object", function() {
var actual = {x: {a: 1, b: 4, c: 3, extra: 'ignored'}};
var expected = {x: jasmineUnderTest.objectContaining({a: 1, b: 2, c: 3})};
expect(compareEquals(actual, expected).message).toEqual('Expected $.x.b = 4 to equal 2.')
expect(compareEquals(actual, expected).message).toEqual('Expected $.x.b = 4 to equal 2.');
});
it("reports mismatches between a non-object and objectContaining", function() {