Setup & Teardown
Unit Test Structure Setup
beforeAll: Is run once before all the tests in a describe. This method executes the functions in charge of configuring or restoring the test environment.
afterAll: Is run once after all the tests in a describe. This method executes the functions in charge of cleaning the environment affected by the execution of the test suit.
beforeEach: Is run before each test in a describe. This method executes the functions in charge of configuring or restoring the environment to be clean before the execution of each test.
afterEach: Is run after each test in a describe. This method executes the functions in charge of cleaning the environment after it has been affected by a previously executed test.
fixture: It is the container of the component and the testing environment.
Unit Test Teardown
It is responsible for the restoration or cleaning of the test environment for each test or test suit.
The cleaning of the testing environment consist of:
Mock cleaning: JEST Mocks.
Timers restoring: FakeTimers.
Last updated