jasmine-immutablejs-matchers
v0.1.2
Published
Jasmine matchers for Immutable.js
Downloads
288
Maintainers
Readme
jasmine-immutablejs-matchers
Jasmine matchers for Immutable.js
This package provides 2 matchers toBeImmutable
and toEqualImmutable
for testing and verifying Immutable objects for Jasmine 2.x
Requirements
- Jasmine 2.x
Installation
Install via npm:
npm install jasmine-immutablejs-matchers
Usage
Node.js
Require into your tests and use:
require('jamsine-immutablejs-matchers');
it("should confirm Immutability", function() {
var data = Immutable.Map({'a': 1, 'b': 2});
expect(data).toBeImmutable();
});
Browser
<script src="/node_modules/jasmine-immutablejs-matchers/index.js"></script>
Matchers
toBeImmutable() - confirm Immutability
var data = Immutable.Map({'a': 1, 'b': 2});
expect(data).toBeImmutable();
toEqualImmutable() - confirm equality / inequalitiy
var data = Immutable.Map({'a': 1, 'b': 2});
expect(data).toEqualImmutable(data);
var obj = {'a': 1, 'b': 2};
var data = Immutable.Map(obj);
expect(data).not.toEqualImmutable(obj);
Credits
toEqualImmutable
based on theis
matcher straight from Lee Byron's gist- Joel Lanciaux
- Ryan Lanciaux
- Jeff Barczewski