Netherworld's Pretend Minibar
Miss any of our Open RFC calls?Watch the recordings here! »

jasmine-immutablejs-matchers

0.1.2 • Public • Published

jasmine-immutablejs-matchers

Jasmine matchers for Immutable.js

Build Status

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 the is matcher straight from Lee Byron's gist
  • Joel Lanciaux
  • Ryan Lanciaux
  • Jeff Barczewski

Install

npm i jasmine-immutablejs-matchers

DownloadsWeekly Downloads

704

Version

0.1.2

License

MIT

Last publish

Collaborators

  • avatar