Skip to content

Commit

Permalink
Merge pull request #67 from slobo/patch-1
Browse files Browse the repository at this point in the history
Better diff output when comparing
  • Loading branch information
astorije authored Nov 22, 2017
2 parents 9638232 + d206afc commit e835034
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
4 changes: 2 additions & 2 deletions chai-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@
Immutable.is(obj, collection),
'expected #{act} to equal #{exp}',
'expected #{act} to not equal #{exp}',
collection.toString(),
obj.toString(),
collection.toJS(),
obj.toJS(),
true
);
}
Expand Down
18 changes: 16 additions & 2 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,16 @@ describe('chai-immutable (' + typeEnv + ')', function () {
it('should display a helpful failure output on big objects', function () {
var actual = new Map({ foo: 'foo foo foo foo foo foo foo foo' });
var expected = new Map({ bar: 'bar bar bar bar bar bar bar bar' });
// AssertionError: expected { Object (foo) } to equal { Object (bar) }
// + expected - actual
//
// {
// - "foo": "foo foo foo foo foo foo foo foo"
// + "bar": "bar bar bar bar bar bar bar bar"
// }
fail(function () {
expect(actual).to.equal(expected);
}, /(foo ?){8}.+(bar ?){8}/);
}, 'AssertionError: expected { Object (foo) } to equal { Object (bar) }');
});

it('should fail given a non-Immutable value', function () {
Expand Down Expand Up @@ -744,9 +751,16 @@ describe('chai-immutable (' + typeEnv + ')', function () {
it('should display a helpful failure output on big objects', function () {
var actual = new Map({ foo: 'foo foo foo foo foo foo foo foo ' });
var expected = new Map({ bar: 'bar bar bar bar bar bar bar bar ' });
// AssertionError: expected { Object (foo) } to equal { Object (bar) }
// + expected - actual
//
// {
// - "foo": "foo foo foo foo foo foo foo foo"
// + "bar": "bar bar bar bar bar bar bar bar"
// }
fail(function () {
assert.equal(actual, expected);
}, /(foo ){8}.+(bar ){8}/);
}, 'AssertionError: expected { Object (foo) } to equal { Object (bar) }');
});

it('should fail given a non-Immutable value', function () {
Expand Down

0 comments on commit e835034

Please sign in to comment.