I want to test that my label component is properly parsing the data in the principal object.
This is my label:
<label id="userInfo"><b>Logged in as: </b>{principal.emailAddress}, <b>Role: </b>{userRole}</label>
And this is my test, which is not currently working:
describe("Testing User Info displaying correctly", () =>{
it("when provided principal data, it should correctly combine the username and role", () => {
expect(wrapper.find('[data-test-id="userInfo"]').text()).to.equal("Logged in as: [email protected], Role: Subscriber");
});
});
How can I check that the value of my label, or more accurately the text between the tags, is being shown correctly?
Currently the test fails with the following message:
"Method “text” is only meant to be run on a single node. 0 found instead."