From the course: React: Testing and Debugging
Unlock the full course today
Join today to access over 24,900 courses taught by industry experts.
Organize your tests with describe() - React.js Tutorial
From the course: React: Testing and Debugging
Organize your tests with describe()
- [Instructor] As your list of tests grows you might have the need to organize your tasks beyond the simple file organization. Each file is a test suite and then it runs a test inside of the suite. But you might need to organize your tests further and you can do this with the describe method. The main advantage of doing this is to block your test around the context of what you're trying to test. Let's refactor our code a bit to demonstrate an example and how you go about doing this. So I'm back into the grid.test.js where I have this big massive test here and what I'm going to do is refactor all this. So the first thing we're going to do is refactor the numbers area. So I'm going to hit return after the variable that I created here and I'm going to create a describe. And this is basically how you block several tasks together. So we're going to call this number test. And then again it's a function. And then all we…
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)
-
-
-