how to test and resolve Controller data (.then function()) promise and get orginal Data in Jasmine2

前端 未结 2 1042
小鲜肉
小鲜肉 2020-12-07 06:14
    I am testing a controller that uses a service that returns a promise. I need to resolve promise. I am using Jasmine 2. 

    Here is Spec code

      beforeEach(         


        
2条回答
  •  星月不相逢
    2020-12-07 06:41

    If you want the spyOn to actually use the correct implementation instead of the mock you can use callThrough() instead of callFake().

    Try it like this:

    spyOn(myService, "getDateRangeData").and.callThrough();
    

提交回复
热议问题