From the course: Vue.js: Testing and Debugging

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Organizing tests

Organizing tests

- [Instructor] Test cases help us test different scenarios in which our code will be used. Wouldn't it be awesome to define the context in which a test is running and group related tests? This will surely be beneficial to properly reading and interpreting test results. Using Jest, we have the ability to group tests using describe blocks. This way we can group and label related tests and also define dependencies per test group. Let's dive into our code and see how we can use describe blocks to group all the tests written so far. In this exercise, we'll be creating a group for the string tests, another group for the numeric tests and a third group for the objects and arrays tests. Inside the test folder, create a new file with the name organized.js. Inside this test suite, let's import all properties contained in the utilities module. Next, we create a container describe block to hold all our test cases. Let's now nest…

Contents