i18next / ng-i18next

translation for AngularJS using i18next
https://github.com/i18next/ng-i18next
MIT License
161 stars 54 forks source link

evalAsync in unit tests not executed - tests not actually run! #70

Closed awk closed 9 years ago

awk commented 9 years ago

In making a change to the directive I wanted to update the unit tests.

I wrote a new test following the current pattern (using evalAsync) and even though the test was clearly going to fail (TDD :-) it passed! I deliberately broke an existing test and it too still passed.

It looks like the function passed to evalAsync is never actually executed during the tests - and since that's where the expect() call is - it never fails.

Adding a $rootScope.$apply() causes the function passed to evalAsync to pass - however that leads to more indications that this code is dead - the functions all call 'done();' - however that function is not in scope.

Is 'done()' supposed to be the method from Jasmine 2.0 ? It looks like the project is still using Jasmine 1.3.x ? (and anyways in jasmine 2.0 done is passed in as an argument to it() etc)

efolio commented 9 years ago

done only exists in Jasmine 2 yes.

awk commented 9 years ago

A pull request to fix the unit tests is at https://github.com/i18next/ng-i18next/pull/71

bugwelle commented 9 years ago

I'll close this now. :) Thanks for your pull request. :+1:

Regards, Andre