Unit testing an asynchronous service in angularjs

前端 未结 2 759
感情败类
感情败类 2020-12-05 15:18

I am trying to unit test a service which has asynchronous methods but am having no luck.

I have tried to implement with promises by using the $q support in angularjs

2条回答
  •  余生分开走
    2020-12-05 15:31

    It's not related to Angular itself, but to Jasmine async tests.

    If you need a setTimeout use Angular $timeout. And if you wish to have a fine control over setTimeout/$timeout executions, use mocked Clock.

提交回复
热议问题