mjackson/expect

toInclude doesn't work with Map object

Open

#176 opened on Dec 3, 2016

View on GitHub
 (6 comments) (0 reactions) (0 assignees)JavaScript (132 forks)batch import
enhancementhelp wantedquestion

Repository metrics

Stars
 (2,290 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Example:

it('toInclude should work for Maps', () => {
  const obj = { a: 'a', b: 'b', c: 'c' };
  const map = new Map();
  Object.keys(obj).forEach(k => {
    map.set(k, obj[k]);
  });
  expect(map).toInclude({ b: 'b' });
});

Error: Expected Map (3) {'a' => 'a', 'b' => 'b', 'c' => 'c'} to include { b: 'b' }

Contributor guide