mjackson/expect

toInclude doesn't work with Map object

Open

#176 opened on Dec 3, 2016

 (6 comments) (0 reactions) (0 assignees)JavaScript (115 forks)batch import
enhancementhelp wantedquestion

Repository metrics

Stars
 (2,270 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