Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Testing Library .toHaveTextContent exact match

How do I make expect(stuff).toHaveTextContent(text) pass only when the text matches exactly?

.toHaveTextContent("1") counts as a match if the text I'm testing is "100"

like image 524
newbieProgrammer Avatar asked Nov 07 '22 01:11

newbieProgrammer


1 Answers

You can do the ff instead:

expect(stuff.textContent).toBe('100')
like image 149
Wani Avatar answered Nov 12 '22 16:11

Wani