1 00:00:01,020 --> 00:00:01,853 Instructor: All right, 2 00:00:01,853 --> 00:00:03,780 I hope you had some success putting that test together 3 00:00:03,780 --> 00:00:06,600 to make sure that our app component shows an instance 4 00:00:06,600 --> 00:00:08,220 of the comment list. 5 00:00:08,220 --> 00:00:09,780 So in this section we're gonna walk through 6 00:00:09,780 --> 00:00:13,170 the actual implementation of that test. 7 00:00:13,170 --> 00:00:14,250 I'm gonna first get started 8 00:00:14,250 --> 00:00:18,090 by importing the comment list component into this file. 9 00:00:18,090 --> 00:00:19,590 Anytime we want to say that, 10 00:00:19,590 --> 00:00:21,720 yeah the app shows this other component, 11 00:00:21,720 --> 00:00:25,380 we need to actually know what that other component is. 12 00:00:25,380 --> 00:00:26,520 So at the top up here, 13 00:00:26,520 --> 00:00:31,520 I'm going to import comment list from comment list. 14 00:00:32,610 --> 00:00:34,290 Then once I've got that imported, 15 00:00:34,290 --> 00:00:36,510 I'll then create an it statement down here 16 00:00:36,510 --> 00:00:38,670 that's going to attempt to write out that test 17 00:00:38,670 --> 00:00:41,070 and make the actual expectation. 18 00:00:41,070 --> 00:00:44,400 So I'll say it, which is a reference to the app 19 00:00:44,400 --> 00:00:46,320 not an actual like programmatic reference 20 00:00:46,320 --> 00:00:48,990 but kinda like a verbal reference of sorts. 21 00:00:48,990 --> 00:00:51,693 So it shows a comment list. 22 00:00:54,300 --> 00:00:56,220 Then inside of here we'll create an instance 23 00:00:56,220 --> 00:00:58,830 of our app component using the shallow render 24 00:00:58,830 --> 00:01:00,840 just as we did before. 25 00:01:00,840 --> 00:01:04,137 We'll say const wrapped = shallow( 00:01:09,540 And then we'll write out our expectation. 27 00:01:09,540 --> 00:01:13,110 So I'll make sure that wrapped.find 28 00:01:13,110 --> 00:01:15,730 and we're gonna look for an instance of comment list 29 00:01:17,400 --> 00:01:19,860 and I expect there to be an array coming back 30 00:01:19,860 --> 00:01:22,530 of all the copies of the comment list that were found, 31 00:01:22,530 --> 00:01:26,460 so I want to get specifically just the length of that list 32 00:01:26,460 --> 00:01:29,460 and I want to make sure that the length is equal to one 33 00:01:29,460 --> 00:01:33,000 'cause we should only have one copy of the comment list. 34 00:01:33,000 --> 00:01:35,490 So I'll put down my matcher of twoEqual 35 00:01:35,490 --> 00:01:37,713 and say that the value should equal one. 36 00:01:39,240 --> 00:01:40,770 All right, so I'll save this file 37 00:01:40,770 --> 00:01:43,830 and I'll flip back over my terminal and see how I'm doing. 38 00:01:43,830 --> 00:01:46,050 So back over here, it looks like my tests are running 39 00:01:46,050 --> 00:01:48,210 and I've got a second passing test. 40 00:01:48,210 --> 00:01:50,460 Awesome, so this looks pretty good 41 00:01:50,460 --> 00:01:53,790 and hopefully you came to the same solution as well. 42 00:01:53,790 --> 00:01:54,810 Let's take a break right here 43 00:01:54,810 --> 00:01:56,760 and we'll continue in the next section.