mjackson/expect

toInclude doesn't work with Map object

Open

#176 建立於 2016年12月3日

在 GitHub 查看
 (6 留言) (0 反應) (0 負責人)JavaScript (2,290 star) (132 fork)batch import
enhancementhelp wantedquestion

描述

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' }

貢獻者指南

toInclude doesn't work with Map object · mjackson/expect#176 | Good First Issue