0

$httpBackend offers methods for check if an HTTP call is made:

$httpBackend.expectGET('/auth.py');

I'm testing a service that has an internal cache and I would like to check if it works correctly. The idea is to check if the GET call is NOT made after a second request.

I'm using Karma and Jasmine.

Fedy2
  • 3,147
  • 4
  • 26
  • 44
  • expectGet has to be setup for each GET request. If an unwanted call is made it will fail, as remote invocation is not allowed during unit test. – Chandermani Mar 25 '15 at 11:13

1 Answers1

2

This should do the trick :

it('should be cache', function() {

 myCacheStuff();
 $httpBackend.flush();
 $httpBackend.verifyNoOutstandingRequest();
})
Boris Charpentier
  • 3,515
  • 25
  • 28