concept beforeEach in category javascript

appears as: beforeEach
Testing JavaScript Applications

This is an excerpt from Manning's book Testing JavaScript Applications.

Jest also provides beforeAll and beforeEach hooks. Because both of your tests need to clean the database before they run, you can encapsulate that behavior into a beforeEach hook. If you do this, there’s no need to repeat those truncate statements on every test.