chai-immutable
Advanced tools
Comparing version 2.0.0-rc.2 to 2.0.0-rc.3
@@ -127,3 +127,3 @@ 'use strict'; | ||
* The `include` and `contain` assertions can be used as either property | ||
* based language chains or as methods to assert the inclusion of a value | ||
* based language chains or as methods to assert the inclusion of a value or subset | ||
* in an immutable collection. When used as language chains, they toggle the | ||
@@ -138,2 +138,4 @@ * `contains` flag for the `keys` assertion. | ||
* expect(new List([1, 2, 3])).to.deep.include(2); | ||
* expect(new Map({ foo: 'bar', hello: 'world' })).to.include('bar'); | ||
* expect(new Map({ a: 1, b: 2, c: 3 })).to.include(new Map({ a: 1, b: 2 })); | ||
* expect(new Map({ foo: 'bar', hello: 'world' })).to.include.keys('foo'); | ||
@@ -156,4 +158,7 @@ * ``` | ||
if (Immutable.Iterable.isIterable(obj)) { | ||
const isIncluded = | ||
obj.includes(val) || | ||
(Immutable.Iterable.isIterable(val) && obj.isSuperset(val)); | ||
this.assert( | ||
obj.includes(val), | ||
isIncluded, | ||
'expected #{act} to include #{exp}', | ||
@@ -160,0 +165,0 @@ 'expected #{act} to not include #{exp}', |
{ | ||
"name": "chai-immutable", | ||
"version": "2.0.0-rc.2", | ||
"version": "2.0.0-rc.3", | ||
"description": "Chai assertions for Facebook's Immutable library for JavaScript collections", | ||
@@ -12,3 +12,3 @@ "main": "chai-immutable.js", | ||
"lint:eslint": "eslint --ignore-path .gitignore . --report-unused-disable-directives", | ||
"lint:prettier": "prettier --list-different \"**/*.{js,md}\"", | ||
"lint:prettier": "prettier --list-different \"**/*.{html,js,json,md,yml}\"", | ||
"test": "run-s -c test:* lint:* eslint-check:*", | ||
@@ -50,9 +50,9 @@ "test:readme": "mocha --compilers md:fulky/md-compiler README.md", | ||
"devDependencies": { | ||
"chai": "4.1.2", | ||
"coveralls": "3.0.1", | ||
"eslint": "4.19.1", | ||
"eslint-config-prettier": "2.9.0", | ||
"eslint-plugin-chai-expect": "1.1.1", | ||
"chai": "4.2.0", | ||
"coveralls": "3.0.2", | ||
"eslint": "5.9.0", | ||
"eslint-config-prettier": "3.2.0", | ||
"eslint-plugin-chai-expect": "2.0.1", | ||
"eslint-plugin-chai-friendly": "0.4.1", | ||
"eslint-plugin-mocha": "5.0.0", | ||
"eslint-plugin-mocha": "5.2.0", | ||
"fulky": "0.2.0", | ||
@@ -62,5 +62,5 @@ "immutable": "3.8.2", | ||
"npm-run-all": "4.1.3", | ||
"nyc": "11.8.0", | ||
"prettier": "1.13.0" | ||
"nyc": "13.1.0", | ||
"prettier": "1.15.2" | ||
} | ||
} |
@@ -142,5 +142,5 @@ [![npm Version](https://img.shields.io/npm/v/chai-immutable.svg)](https://npmjs.org/package/chai-immutable) | ||
The `include` and `contain` assertions can be used as either property | ||
based language chains or as methods to assert the inclusion of a value | ||
in an immutable collection. When used as language chains, they toggle the | ||
`contains` flag for the `keys` assertion. | ||
based language chains or as methods to assert the inclusion of a value or | ||
subset in an immutable collection. When used as language chains, they toggle | ||
the `contains` flag for the `keys` assertion. | ||
@@ -153,2 +153,4 @@ Note that `deep.include` behaves exactly like `include` in the context of | ||
expect(new List([1, 2, 3])).to.deep.include(2); | ||
expect(new Map({ foo: 'bar', hello: 'world' })).to.include('bar'); | ||
expect(new Map({ a: 1, b: 2, c: 3 })).to.include(new Map({ a: 1, b: 2 })); | ||
expect(new Map({ foo: 'bar', hello: 'world' })).to.include.keys('foo'); | ||
@@ -155,0 +157,0 @@ ``` |
42484
774
422