At Salt testing is a great deal for us and we focus on writing tests for all the programs/applications we build. This is because we know that our clients appreciate that our developers are confident with testing tools. Testing applications provides confidence to software development teams knowing that their applications/products are robust and stable. And if there were any bugs introduced as regressions or in generla, the tests will catch them and thus won't reach production. This helps ensure the quality of a application/product.
When we start to work with tests the first time, they seem difficult, just like everything else. But practice makes it easier and you'll be a pro in testing in no time at salt.
There are many testing frameworks suitable for JavaScript code, but some are more widely used and popular than others. At Salt we've decided to focus on Jest.
Jest is a very popular testing tool (built by Facebook) that comes with built-in assertion and mocking abilities. Apart from being used for unit tests for basic javascript/nodejs applications, Jest is also used testing React applications which we'll do later in the course.
As mentioned above you will be testing extensively at Salt. Most of the tests that you will be writing are so called Unit Tests. There are also other kinds of tests and we normally divide tests into the following categories: Unit Tests, Integration Tests, End-to-End Tests, and Static Code Analysis. The categories have their respective place within the Test Trophy. Kent C. Dodds wrote an amazing article about this. It is a must read.
If we look at sorting the trophy in terms of least implementation complexity, the direction is from the bottom to the top. As shown in the visualization above, static analysis is the easiest which we do using ESLint at salt. We then focus on the unit tests using Jest. And when required, we use the integration tests and e2e tests with Testing Library & Cypress respectively.
From here, select the correct folder to work from JavaScript or TypeScript. See you there!