Tests are important to ensure that the product is working as expected. We know, that test can be a bit tricky, but we want to help you to get started.
Here are templates and tricks to create your test for KlexSign.
Testing the backend is very complicated. We have a lot of different tools to test the backend.
The Backend is separated into different test suites.
We want ensure, that every defined mongodb query work as expected. So every new query should be tested. Please extend the test if you add a new query.
So don't create tests that required or depend on datasets that not inserted / modified in the same test. We know, that this slowes down the tests. But this is the only way we can ensure that nothing will break if we change the datasets or the order of the tests.
This can save us time and nights debugging in the future.
Generally we don't want to test the database connection, but we want to test the database queries. So don't mock the repository or single queries.
CreateDate Yeah, thats tricky. The date of creation are generated in the DTO. So it is in each condition different. We don't want to mock the Class, so we ignore the Date on all tests.
coming soon :D
On the frontend, we use only integration tests. That is not a rule but nobody write tests for the frontend in the past. :D
Please ensure, that you onle create Selector for ids. This is the only way to ensure, that you are testing the right element and nobody can break your tests.