cách xác minh rằng không có phương thức yêu cầu http nào được gọi để thực hiện bất kỳ yêu cầu nào. Tôi có mã này:Cách xác minh rằng yêu cầu http không được thực hiện?
$scope.getSubnetsPageDetails = function (pageNumber) {
$http.get(URLS.subnetsPagesCount(pageNumber)).success(function (response) {
$scope.pageDetails = response;
}).error(function (response, errorCode) {
});
};
và thử nghiệm này:
it("should not allow request with negative page number", function() {
scope.getSubnetsPageDetails(-1);
//verify that htt.get is not invoked at all
});
Làm thế nào để xác minh rằng http.get không gọi?