Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better diff output when comparing #67

Merged
merged 2 commits into from
Nov 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -749,9 +756,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