Unexpected request: GET No more request expected at $httpBackend

前端 未结 1 1403
野性不改
野性不改 2020-12-10 11:17

I have a function in my scope to retrieve the status of my service when the user clicks a button, or when some event are triggered and this function is automatically calle

相关标签:
1条回答
  • 2020-12-10 11:54

    You need to supply the whenGET before you call the method.

    it('Should get the status', function() {
        scope.serviceId = '09bb5943fa2881e1';
        $httpBackend.whenGET(configuration.entrypoint + configuration.api + '/outbound/service/' + scope.serviceId).respond(200, {"meta":{"apiVersion":"0.1","code":200,"errors":null}});
        scope.getStatus();
    });
    

    Set up the expectation of the request then trigger the request.

    Hope this helps.

    0 讨论(0)
提交回复
热议问题