AssertIn this section we verify that the unit of code, effectively, produces the expected result for the simulated situation. Only one exit point must be verified for each unit test and it's that exit point this section is focused on. test("the airplane st...Oct 23, 2022路1 min read
- Act -In this section we execute the unit of code that we're going to test through its entry point by using the required parameters to simulate the situation we're going to verify in the unit test. test("the airplane state should be FLYING after takeoff", ...Oct 23, 2022路1 min read
ArrangeIn this section we are in charge of initializing all the dependencies (real or test doubles) required to simulate the situation we are going to verify in the unit test. test("the airplane state should be FLYING after takeoff", () => { /** * Noti...Oct 23, 2022路1 min read
AAA - Test StructureIt's the structure used for a unit test. Each letter stands for a section: Arrange: The dependencies to simulate the situation to verify. Act: Execute the unit of code. Assert: That the final result is as expected. It's suggested that each section ...Oct 23, 2022路1 min read
- Stub -Test double used to simulate an external dependency that sends information into the unit of code. It lets us control the info received by the unit of code. Multiple Stubs can exist in a test. Given that it inserts information into the test WE DO NOT ...Oct 23, 2022路2 min read
- Mock -Test double used to simulate an external dependency that receives information sent by the unit of code. It allows to validate that information.. It can only exist ONE MOCK at most per test, given that it simulates an exit point and only one is verifi...Oct 23, 2022路2 min read