我很难尝试在Angularjs中测试基于promise的代码。我的Controller中有以下代码:$scope.markAsDone=function(taskId){tasksService.removeAndGetNext(taskId).then(function(nextTask){goTo(nextTask);})};functiongoTo(nextTask){$location.path(...);}我想对以下情况进行单元测试:当markAsDone被调用时,它应该调用tasksService.removeAndGetNext当tasksService.removeAn
我很难尝试在Angularjs中测试基于promise的代码。我的Controller中有以下代码:$scope.markAsDone=function(taskId){tasksService.removeAndGetNext(taskId).then(function(nextTask){goTo(nextTask);})};functiongoTo(nextTask){$location.path(...);}我想对以下情况进行单元测试:当markAsDone被调用时,它应该调用tasksService.removeAndGetNext当tasksService.removeAn