immutable.js extension for mjackson/expect
npm install expect-immutable
- expect(ImmutableIterable).toEqualImmutable(ImmutableIterable)
- expect(ImmutableIterable).toNotEqualImmutable(ImmutableIterable)
import { Map, List } from 'immutable';
import expect from 'expect'
import expectImmutable from 'expect-immutable';
expect.extend(expectImmutable);
describe('expect-immutable', () => {
it('will work', () => {
expect(Map({ a: 1 })).toEqualImmutable(Map({ a: 1 }));
expect(Map({ a: 1 })).toNotEqualImmutable(Map({ a: 2 }));
expect(List([1])).toEqualImmutable(List([1]));
expect(List([1])).toNotEqualImmutable(List([1, 2]));
});
});
Currently, only Map
and List
are supported by test cases, but any Immutable Iterable should work.
Thanks to mjackson for writing the awesome expect library.
Thanks to algolia/expect-jsx who I based heavily off of.