From the course: React: Testing and Debugging

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Organize your tests with describe()

Organize your tests with describe() - React.js Tutorial

From the course: React: Testing and Debugging

Start my 1-month free trial

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…

Contents