How do unit test with angular-translate

后端 未结 11 1939
死守一世寂寞
死守一世寂寞 2020-12-08 09:38

I have uses angular translate from here (http://pascalprecht.github.io/angular-translate/) and it\'s just work fine, but it break my controller\'s unit test whith Error:

11条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-08 10:00

    Please have a look at https://github.com/PascalPrecht/angular-translate/blob/master/test/unit/service/loader-static-files.spec.js as a reference.

    In general, I would recommend using a standard translation loader for unit tests (without the hassle of http loadings) which means you can provide the labels with $translateProvider.translations(). Why? Because you do not have to test the remote loading functionality which is part of angular-translate project.

提交回复
热议问题