A demo app for unit testing in Angular.
Run npm install
and npm test
.
- I updated angular version to 1.6.1. Angular 1.2 was released on 2014 which is a almost obselete version. Please use at least 1.5. There are some changes I have to made because angular changes, in order to pass tests.
- For any
JSONP
urls they have to be whitelisted in config by$sce
service. See code line20-25. JSONP
'scallback
parameter changes tojsonpCallbackParam
.- Before I wanted to refactor
$http
services in controller into a soleService
module but because of code's tight couple and I'm kind of lazy, I didn't finish it. But for unit test and code modularity it is recommended to do so. - There is a demo
Service
calledservice.js
and demo unit test specs in test/Service/demoSpec.js which showes unit test for services.