Skip to content
This repository has been archived by the owner on Aug 6, 2024. It is now read-only.

Latest commit

 

History

History
19 lines (12 loc) · 934 Bytes

unit_tests.md

File metadata and controls

19 lines (12 loc) · 934 Bytes

Unit tests

Unit tests are done with Jasmine. All tests are written in the 'test' directory. For tests, the same directory structure should be used as the file you are testing.

Running grunt test or grunt karmawill run the unit tests with karma.

Test coverage

A test coverage report is generated when grunt karma is run. This can be found inside the coverage folder.

The test coverage percentage should be as high as possible.

Test specificity

Tests should be written to be granular. Only test functionality in one layer of the application. Spy objects can be used to separate dependencies.

E.g:

  • In a compnent controller, only test what happens in the controller. Create a Spy object for the service and its used methods, that resolve or reject what is expected.
  • Use the $httpBackend object to fake the calls in the services to the Silex API.