Skip to content

bratushka/expect-immutable

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

expect-immutable

immutable.js extension for mjackson/expect

api

  • expect(ImmutableIterable).toEqualImmutable(ImmutableIterable)
  • expect(ImmutableIterable).toNotEqualImmutable(ImmutableIterable)
  • expect(ImmutableIterable).toBeSupersetImmutable(ImmutableIterable)
  • expect(ImmutableIterable).toBeSubsetImmutable(ImmutableIterable)

usage

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().set(1, 2)).toEqualImmutable(Map().set(1, 2));
    expect(Map().set(1, 2)).toNotEqualImmutable(Map().set("1", 2));
    expect(Map({1: 2, 3: 4})).toBeSupersetImmutable(Map({1: 2}));
    expect(Map({1: 2})).toBeSubsetImmutable(Map({1: 2, 3: 4}));
  });
});

TODO

Prettify the error messages to make them similar to expect library.

thanks

Thanks to mjackson for expect library.

Thanks to hunterc, this library is a fork of his expect-immutable.

About

immutable.js extension for expect

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%