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 - 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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Test strings with matchers3m 46s
-
(Locked)
Test numbers with matchers5m 46s
-
(Locked)
Solution: Test numbers with matchers3m 17s
-
(Locked)
Test arrays and objects with matchers7m 32s
-
(Locked)
Solution: Test object with matchers3m 8s
-
(Locked)
Code coverage reports3m 15s
-
(Locked)
Snapshot testing with Jest5m 13s
-
(Locked)
Organize your tests with describe()4m 51s
-
(Locked)
-
-
-