From the course: React: Testing and Debugging

Unlock the full course today

Join today to access over 24,900 courses taught by industry experts.

Solution: Test object with matchers

Solution: Test object with matchers - React.js Tutorial

From the course: React: Testing and Debugging

Solution: Test object with matchers

(upbeat music) - [Instructor] Okay, so let's discuss the solution for this coding challenge. So I'm not going to go through the instructions. I think it's a good exercise to actually go through the test code here and read them to understand what we're looking for. So basically the two tests that we're actually looking for, and what needs to be updated, is one, we actually need to make sure that when we are rendering here, we're actually seeing the name and we're seeing the email, so the very first fix that we have to do is there's fixes in the test code too, but there are a fix that we need to do in here 'cause right now we're hard coding unknown. We need to pass the actual user. So the user here is passed, but not used anywhere in the component. So let's go ahead and do that. That's the very first fix. So we need to pass the user name. So if we go in here for the default user, you see we're passing a name, we're passing an email, we could also pass the idea, but we're not really…

Contents