Testing the application’s features
When implementing an application, especially if you’re following a test-driven development (TDD) approach, it might be more interesting to write tests that verify the behavior of an actual application feature from the user’s perspective rather than specific units of code from a component’s technical perspective. The resulting tests will provide value from a business point of view and ensure, in an automated and sustainable way, that the application as a whole behaves according to what was requested in its specification. For this purpose, we’ll create the following files:
src/auth/auth.test.js
src/projects/projects.test.js
src/tasks/tasks.test.js
src/users/users.test.js
Each of these files will contain tests that verify the application’s features related to its containing module work as expected. For example, the users.test.js
file contains tests that verify the task manager’...