Error: Unexpected request: POST karma

Error: Unexpected request: POST karma

当我 运行 我的测试用例 Error: Unexpected request: POST data/json/api.json

时出现以下错误
it("should $watch value", function(){
      var request = '/data/json/api.json';
      $httpBackend.expectPOST(request).respond(200);

      var iplScore = 10;
      var controller = new controller(iplScore);
      $scope.cricketScore = 0;
      $scope.$digest();
      $scope.cricketScore = 1;
      assert.equal(iplScore, 0);
 });

下面是我的控制器代码:

$scope.$watch("cricketScore", function(newValue, oldValue) {
     $scope.iplScore = oldValue;
});

任何人都可以帮我解决为什么我会收到上述错误,即使我已经通过 $httpBackend

嘲笑了 api

没有嘲笑您的API电话。将以下内容放入 beforeEach():

beforeEach(function () {
    $httpBackend.when('POST', '/data/json/api.json').respond(200, {
        status: "success"
    });
});