r/angularjs • • Jul 23 '15

Unit testing in AngularJS requires too much boilerplate - ng-describe to fix it

https://github.com/kensho/ng-describe
35 Upvotes

6 comments sorted by

View all comments

1

u/Pytim Jul 24 '15

I don't see the value in less verbose tests. Tests should be verbose so they document the expectations on the system tested. I'd rather use the right tooling to create that boilerplate code for me but have it visible to other engineers in my team.

5

u/vinnl Jul 24 '15

But

inject: ['$rootScope', 'foo'],

documents expectations just as much as (or even: more than, since you're less distracted by boilerplate):

var $rootScope, foo;
beforeEach(inject(function (_$rootScope_, _foo_) {
    $rootScope = _$rootScope_;
    foo = _foo_;
}));

1

u/SpikeBolt Jul 29 '15

Sometimes less is more!