Frontend tests
Opened this issue · 2 comments
... there are none. I aim to change that.
Some rough ideas for bringing tests in:
End to End Tests
Protractor will basically run your app and click on stuff to make sure it all works. We need a Protractor test or two that navigates through whatever big workflows we've got. No need to look at edge cases for a Protractor test; they're designed to catch app-breaking behavior and thus they follow the so-called 'happy paths'.
Directive Tests
These are kind of like unit tests, but require some careful handling since you have to mock out a lot of stuff, which is why we need...
Service/Unit Tests
Currently we don't have any services, which also needs to be fixed. Frontend logic is easiest to test when it is in a service and not in a controller.
So while rewriting the front-end in Angular 2, the nifty tool Angular-Cli actually generates test templates to use. I think I can definitely add tests to test basic features such as clicking buttons and whatnot. Also anything that interacts with the backend has been put into its own service, which should allow for easier testing. The services are auth, blog, competitions, problems, submissions, and the websocket service.