3 ms·
This is a really nice article, it seems you found a similar solution to mine. The only thing that is more or less difficult about testing Angular ist the boile
by iagooar 13y ago
This is a really nice article, it seems you found a similar solution to mine.
The only thing that is more or less difficult about testing Angular ist the boilerplate one has to write to instantiate everything correctly. When writing the code, Angular handles the bootstrapping of the application, but in the tests one has to do it manually.
What's positive about it is that one learns how Angular works internally. I would even say that doing TDD with Angular is actually a lot of fun.
- awinder 13y agoDefinitely agree with this. The function passed to the inject() method where you set up your controller and inject mocks seems to have a bunch of repetition in the unit test suites I've been writing. You can use $provide (http://docs.angularjs.org/api/AUTO.$provide http://docs.angularjs.org/api/AUTO.$provide) to swap dependencies at the injector level and I'm starting to wonder if doing that would be a lot more repeatable across unit test suites.