Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8852217
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T13:20:39+00:00 2026-06-14T13:20:39+00:00

how to verify that none of http request method are invoked to do any

  • 0

how to verify that none of http request method are invoked to do any request. I have this code :

 $scope.getSubnetsPageDetails = function (pageNumber) {
        $http.get(URLS.subnetsPagesCount(pageNumber)).success(function (response) {
            $scope.pageDetails = response;
        }).error(function (response, errorCode) {

            });
    }; 

and this test :

it("should not allow request with negative page number", function () {

        scope.getSubnetsPageDetails(-1);
        //verify that htt.get is not invoked at all

    });

How to verify that http.get is not invoked ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T13:20:40+00:00Added an answer on June 14, 2026 at 1:20 pm

    You can test that no calls are made by using the verifyNoOutstandingRequest() method from the $httpBackend mock.

    Usually those kind of verification is done in the afterEach section of a Jasmine’s tests. On top of this it is common to call another method, verifyNoOutstandingExpectation() to verify that all the expected calls were actually invoked.

    Here is the code, where you need to inject the $httpBackend mock:

    var $httpBackend;
    beforeEach(inject(function($injector) {
      $httpBackend = $injector.get('$httpBackend');
    }));
    

    then do you test and at the end:

    afterEach(function() {
      $httpBackend.verifyNoOutstandingExpectation();
      $httpBackend.verifyNoOutstandingRequest();
    });
    

    Of course you could invoke the $httpBackend.verifyNoOutstandingRequest() inside an individual test. The mentioned http://docs.angularjs.org/api/ngMock.$httpBackend page has a wealth of information on the topic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this form with a JS function to verify that there are no
I have a method that checks for broken links: def self.check_prod_links require 'net/http' results
I need to verify that a code generated in one class is same as
I want to verify that my understanding is correct. This kind of thing is
I have the following script: $('#target').bind('click', function () { $('#target').css({ 'display': 'none' }); $('#targetFake').css({
I have a method that calls another method of a mocked object with a
In Java I'm trying to verify that a URL exists. I do this by
How can I verify that passing block is execute correctly ? - (void)locationManager:(CLLocationManager *)manager
How do you 'verify' that a message sent using MSMQ to a private local
I need to verify that a simplified DTD is really a subset of a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.