Skip to content

Commit

Permalink
Fix #31: Add support for eqls
Browse files Browse the repository at this point in the history
Also add note in README about equality being synonym of deep equality.
  • Loading branch information
astorije committed Nov 5, 2015
1 parent 91d3a49 commit 5bb0c8d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ properly work against `.equal()`. See
[this issue](https://github.com/astorije/chai-immutable/issues/24) for
more information.

Also, note that `deep.equal` and `eql` are synonyms of `equal` when
tested against immutable data structures, therefore they are aliases to
`equal`.

### .include(value)

- **@param** *{ Mixed }* val
Expand Down
6 changes: 6 additions & 0 deletions chai-immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,15 @@
* [this issue](https://github.com/astorije/chai-immutable/issues/24) for
* more information.
*
* Also, note that `deep.equal` and `eql` are synonyms of `equal` when
* tested against immutable data structures, therefore they are aliases to
* `equal`.
*
* @name equal
* @alias equals
* @alias eq
* @alias eql
* @alias eqls
* @alias deep.equal
* @param {Collection} value
* @api public
Expand All @@ -109,6 +114,7 @@
Assertion.overwriteMethod('equals', assertCollectionEqual);
Assertion.overwriteMethod('eq', assertCollectionEqual);
Assertion.overwriteMethod('eql', assertCollectionEqual);
Assertion.overwriteMethod('eqls', assertCollectionEqual);

/**
* ### .include(value)
Expand Down
6 changes: 6 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ describe('chai-immutable (' + typeEnv + ')', function () {
expect(list3).to.eq(List.of(1, 2, 3));
expect(list3).to.not.eq(new List());
expect(list3).to.eql(List.of(1, 2, 3));
expect(list3).to.eqls(List.of(1, 2, 3));
expect(list3).to.not.eql(new List());
expect(list3).to.not.eqls(new List());
expect(list3).to.deep.equal(List.of(1, 2, 3));
expect(list3).to.not.deep.equal(new List());
});
Expand All @@ -104,6 +106,7 @@ describe('chai-immutable (' + typeEnv + ')', function () {
expect(deepMap).to.equals(sameDeepMap);
expect(deepMap).to.eq(sameDeepMap);
expect(deepMap).to.eql(sameDeepMap);
expect(deepMap).to.eqls(sameDeepMap);
expect(deepMap).to.deep.equal(sameDeepMap);
});

Expand All @@ -112,6 +115,7 @@ describe('chai-immutable (' + typeEnv + ')', function () {
expect(deepMap).to.not.equals(differentDeepMap);
expect(deepMap).to.not.eq(differentDeepMap);
expect(deepMap).to.not.eql(differentDeepMap);
expect(deepMap).to.not.eqls(differentDeepMap);
expect(deepMap).to.not.deep.equal(differentDeepMap);
});

Expand All @@ -136,6 +140,7 @@ describe('chai-immutable (' + typeEnv + ')', function () {
fail(function () { expect(deepMap).to.equals(differentDeepMap); });
fail(function () { expect(deepMap).to.eq(differentDeepMap); });
fail(function () { expect(deepMap).to.eql(differentDeepMap); });
fail(function () { expect(deepMap).to.eqls(differentDeepMap); });
fail(function () { expect(deepMap).to.deep.equal(differentDeepMap); });
});

Expand All @@ -144,6 +149,7 @@ describe('chai-immutable (' + typeEnv + ')', function () {
fail(function () { expect(deepMap).to.not.equals(sameDeepMap); });
fail(function () { expect(deepMap).to.not.eq(sameDeepMap); });
fail(function () { expect(deepMap).to.not.eql(sameDeepMap); });
fail(function () { expect(deepMap).to.not.eqls(sameDeepMap); });
fail(function () { expect(deepMap).to.not.deep.equal(sameDeepMap); });
});
});
Expand Down

0 comments on commit 5bb0c8d

Please sign in to comment.