score:0

test('completed todo component should be rendered', () => {
  const sample = {id: 2, name: 'grocery shopping', completed: true};
  render(<Todo todo={sample}/>);
  const todoElement = screen.getByTestId(`todo-${sample.id}`);
  expect(todoElement).toBeInTheDocument();
  expect(todoElement).toHaveTextContent(sample.name);
  expect(todoElement).toMatchSnapshot('<strike>');
});

score:2

expect(todoElement).toContainHTML('strike')

Related Query

More Query from same tag