[master] add tests for routes, refactor tests and main structure