April 2018
Intermediate to advanced
298 pages
6h 34m
English
Suites are the main organizational unit of your tests. Suites aren't a Jest requirement—the test that create-react-app creates does not include a suite:
it('renders without crashing', () => {
...
});
The it() function declares a unit test that passes or fails. When you're just getting your project started and you only have a few tests, there's no need for suites. Once you have several tests, it's time to start thinking about organization. Think of a suite as a container that you can put your tests in. You can have several of these containers that organize your tests however you see fit. Typically, a suite corresponds to a source module. Here's how you declare suites:
describe('BasicSuite', () => { it('passes ...