I have a material UI button and I want to write a test to check if it rendered with the right test. I've tried
expect(wrapper.find('.btn-class').text()).toBe('Next')
but it fails with:
Expected: "Next"
Received: "<Button />"
I have a material UI button and I want to write a test to check if it rendered with the right test. I've tried
expect(wrapper.find('.btn-class').text()).toBe('Next')
but it fails with:
Expected: "Next"
Received: "<Button />"
expect(wrapper.find(".btn-class").prop("children")).toEqual("Next");
It is always better to avoid render.
This was the solution I came up with
expect(wrapper.find('.btn-class').render().text()).toBe('Next')