concept beforeEach in category javascript
appears as: beforeEach

This is an excerpt from Manning's book Testing JavaScript Applications.
Jest also provides
beforeAllandbeforeEachhooks. Because both of your tests need to clean the database before they run, you can encapsulate that behavior into abeforeEachhook. If you do this, there’s no need to repeat thosetruncatestatements on every test.