Socket
Socket
Sign inDemoInstall

chai-immutable

Package Overview
Dependencies
9
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.0-alpha.2 to 2.0.0-rc.1

18

chai-immutable.js

@@ -14,3 +14,3 @@ 'use strict';

})(this, Immutable => (chai, utils) => {
const Assertion = chai.Assertion;
const { Assertion } = chai;

@@ -47,3 +47,3 @@ function assertIsIterable(obj) {

if (Immutable.Iterable.isIterable(obj)) {
const size = obj.size;
const { size } = obj;
new Assertion(size).a('number');

@@ -599,3 +599,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -630,3 +630,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -653,3 +653,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -676,3 +676,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -698,3 +698,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -733,3 +733,3 @@

const size = this._obj.size;
const { size } = this._obj;
new Assertion(size).a('number');

@@ -753,3 +753,3 @@

const assert = chai.assert;
const { assert } = chai;
const originalEqual = assert.equal;

@@ -756,0 +756,0 @@ const originalNotEqual = assert.notEqual;

{
"name": "chai-immutable",
"version": "2.0.0-alpha.2",
"version": "2.0.0-rc.1",
"description": "Chai assertions for Facebook's Immutable library for JavaScript collections",

@@ -11,5 +11,5 @@ "main": "chai-immutable.js",

"lint": "eslint --ignore-path .gitignore . --report-unused-disable-directives",
"test": "npm run test-mocha; npm run test-readme; npm run lint",
"test-readme": "mocha --compilers md:fulky/md-compiler README.md",
"test-mocha": "nyc mocha",
"test": "run-s --continue-on-error test:* lint",
"test:readme": "mocha --compilers md:fulky/md-compiler README.md",
"test:mocha": "nyc mocha",
"coveralls": "nyc report --reporter=text-lcov | coveralls"

@@ -55,4 +55,5 @@ },

"mocha": "5.2.0",
"npm-run-all": "4.1.3",
"nyc": "11.8.0"
}
}

@@ -14,11 +14,12 @@ [![npm Version](https://img.shields.io/npm/v/chai-immutable.svg)](https://npmjs.org/package/chai-immutable)

<!-- fulky:globals
var chai = require('chai');
var assert = chai.assert;
var expect = chai.expect;
const chai = require('chai');
const { assert, expect } = chai;
var Immutable = require('immutable');
var List = Immutable.List;
var Map = Immutable.Map;
var Set = Immutable.Set;
var Stack = Immutable.Stack;
const Immutable = require('immutable');
const {
List,
Map,
Set,
Stack,
} = Immutable;

@@ -32,9 +33,13 @@ chai.use(require('./chai-immutable'));

Install via [npm](http://npmjs.org):
Install via [npm](http://npmjs.org) or [yarn](https://yarnpkg.com/):
```bash
npm install chai-immutable
npm install --save-dev chai-immutable
yarn add --dev chai-immutable
```
⚠️ To use `chai-immutable` with Chai v4, you need to use `npm install chai-immutable@next` instead, until I am done with the v2 release of this plugin. I apologize for the inconvenience in the meantime.
⚠️ **To use `chai-immutable` with Chai v4, you need to use
`npm install --save-dev chai-immutable@next` (or
`yarn add --dev chai-immutable@next`) instead, until I am done with the v2
release of this plugin. I apologize for the inconvenience in the meantime.**

@@ -45,4 +50,4 @@ You can then use this plugin as any other Chai plugins:

```js
var chai = require('chai');
var chaiImmutable = require('chai-immutable');
const chai = require('chai');
const chaiImmutable = require('chai-immutable');

@@ -52,2 +57,12 @@ chai.use(chaiImmutable);

### ES6 syntax (needs Babel transpiling)
<!-- fulky:skip-test -->
```js
import chai from 'chai';
import chaiImmutable from 'chai-immutable';
chai.use(chaiImmutable);
```
### In the browser

@@ -71,16 +86,17 @@

```js
var chai = require('chai');
var chaiAsPromised = require('chai-as-promised');
var chaiImmutable = require('chai-immutable');
var dirtyChai = require('dirty-chai');
var expect = chai.expect;
const chai = require('chai');
const chaiAsPromised = require('chai-as-promised');
const chaiImmutable = require('chai-immutable');
const dirtyChai = require('dirty-chai');
const { expect } = chai;
chai.use(chaiImmutable);
chai.use(chaiAsPromised);
chai.use(dirtyChai);
chai.use(chaiAsPromised);
var List = require('immutable').List;
const { List } = require('immutable');
/* ... */
return expect(List.of(1, 2, 3)).to.eventually.have.size(3);
expect(Promise.resolve(List.of(1, 2, 3))).to.eventually.have.size(3);
expect(true).to.be.true();

@@ -108,4 +124,4 @@ ```

```js
var a = List.of(1, 2, 3);
var b = List.of(1, 2, 3);
const a = List.of(1, 2, 3);
const b = List.of(1, 2, 3);
expect(a).to.equal(b);

@@ -353,4 +369,4 @@ ```

```js
var a = List.of(1, 2, 3);
var b = List.of(1, 2, 3);
const a = List.of(1, 2, 3);
const b = List.of(1, 2, 3);
assert.equal(a, b);

@@ -375,4 +391,4 @@ ```

```js
var a = List.of(1, 2, 3);
var b = List.of(4, 5, 6);
const a = List.of(1, 2, 3);
const b = List.of(4, 5, 6);
assert.notEqual(a, b);

@@ -379,0 +395,0 @@ ```

@@ -32,8 +32,9 @@ 'use strict';

const assert = chai.assert;
const expect = chai.expect;
const List = Immutable.List;
const Map = Immutable.Map;
const Set = Immutable.Set;
const Stack = Immutable.Stack;
const { assert, expect } = chai;
const {
List,
Map,
Set,
Stack,
} = Immutable;

@@ -554,2 +555,3 @@ /*!

expect(nestedObj).not.to.have.nested.deep.property(['y', 'z']);
expect(nestedObj).not.to.have.property('a', new Map({ x: 2 }));
});

@@ -977,2 +979,42 @@

describe('include assertion', function () { // eslint-disable-line prefer-arrow-callback
const map1 = new Map({ a: 1 });
const map2 = new Map({ b: 2 });
const list = new List([map1, map2]);
const map = new Map({ foo: map1, bar: map2 });
it('should ensure deep equality', function () { // eslint-disable-line prefer-arrow-callback
assert.include(list, map1);
assert.include(list, new Map({ a: 1 }));
assert.include(map, map1);
assert.include(map, new Map({ a: 1 }));
});
it('should not treat partial collections as sub-collections', function () { // eslint-disable-line prefer-arrow-callback
fail(() => assert.include(map, new Map({ foo: map1 })));
fail(() => assert.include(map, new Map({ foo: map1, bar: map2 })));
});
});
describe('notInclude assertion', function () { // eslint-disable-line prefer-arrow-callback
const map1 = new Map({ a: 1 });
const map2 = new Map({ b: 2 });
const list = new List([map1, map2]);
const map = new Map({ foo: map1, bar: map2 });
it('should ensure deep equality', function () { // eslint-disable-line prefer-arrow-callback
assert.notInclude(map, new Map({ foo: map1 }));
assert.notInclude(map, new Map({ foo: map1, bar: map2 }));
});
it('should not treat partial collections as sub-collections', function () { // eslint-disable-line prefer-arrow-callback
fail(() => assert.notInclude(list, map1));
fail(() => assert.notInclude(list, new Map({ a: 1 })));
fail(() => assert.notInclude(map, map1));
fail(() => assert.notInclude(map, new Map({ a: 1 })));
});
});
describe('property assertions', function () { // eslint-disable-line prefer-arrow-callback

@@ -1015,2 +1057,4 @@ const obj = Immutable.fromJS({ x: 1 });

assert.notDeepPropertyVal(obj, 'x', 42);
assert.notPropertyVal(obj, 'foo', new Map({ bar: 'baz' }));
assert.notDeepPropertyVal(obj, 'foo', new Map({ bar: 'baz' }));
});

@@ -1017,0 +1061,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc