Now that we have set up Jest, you are going to learn about its features and how to use it for testing in general. In the next section, you are going to learn how to test Redux with Jest.
Using Jest
Using test and describe
We have already learned that tests in Jest are written via the test function:
// example.test.js
test('example test', () =>
expect(1 + 1).toBe(2)
)
Tests are grouped by putting them into separate files. However, we can also group tests within a file using the describe function:
// example.test.js
describe('number tests', () => {
test('example test', () =>
expect(1 + 1).toBe(2)
)
})
If a test is failing, one of the first things you should do is check if the test...