Write tests
Until now there are no tests regarding the backend. Therefore, this issue focuses on writing tests in the backend
For that add a new folder "Tests"
The following tests are important:
-
check if docker container can be created -
connection to MongoDB -
check if authentication is working (skip for now) -
pull schema from git -
pull schema from git and save into db -
pull existing resources from git -
-> save the existing resources in DB -
create new entry in every category (schema conform, no authentication) -
create new entry in every category (schema conform, with authentication) -
create new entry in every category (invalid, with authentication) -
create new entry, then update this entry in every category (schema conform, authentication) -
create new entry, then update this entry in every category (invalid, authentication) -
create new entry, then update this entry in every category (invalid, no authentication)
Things that need to be done besides writing tests
-
Create an environment where tests can run - local and on gitlab pipeline -> best is would be docker -
add the test suite into the gitlab pipeline -> should run on every commit
It is important not to reuse entries that you have created in an earlier test - tests should be written in a way that they can run without having dependencies on other tests
Edited by Mohamed Anis Koubaa