easy5 pts · first answer countsassertionsjavascript
toBe versus toEqual
Why does the first assertion fail while the second passes?
expect({ id: 1, name: 'Pen' }).toBe({ id: 1, name: 'Pen' }) // fails
expect({ id: 1, name: 'Pen' }).toEqual({ id: 1, name: 'Pen' }) // passesDiscussion 0
Join free to post in the discussion.
Related questions
- Comparing decimal resultsAutomation Test Engineer
- A failure message that helpsAutomation Test Engineer
- Checking many fields at onceAutomation Test Engineer
- Checking that a tab is activeAutomation Test Engineer
- Seeing all field failures in JUnitAutomation Test Engineer
- Full text or part of itAutomation Test Engineer
- Checking the number of resultsAutomation Test Engineer
- A toast that vanishes quicklyAutomation Test Engineer