Reputation: 25
I've just started using jest, but some things are not clear to me.
For Example, why if a test this function:
const liElement = object => `<li>${object.title}</li>`;
with:
expect(liElement({title: 'example'}).toBe('<li>example</li>'));
Why my test fail?
Upvotes: 0
Views: 930
Reputation: 169041
You'll want to use expect().toEqual()
instead of the strict identity check expect().toBe()
.
expect(liElement({title: 'example'})).toEqual('<li>example</li>');
Upvotes: 1