Background
I was writing a unit test for my angularjs app and I ran into the following problem.
I was setting up the test correctly to inject in the $httpBackend to mock out the http calls, but the when I called called the service and then called $httpBackend.flush() it would return an error:
httpBackend no pending request to flush
Which is not what I was expecting.
Other background
When I commented out the $httpBackend.whenGET
The following 2 methods in the afterEach function would not throw an error either.
$httpBackend.verifyNoOutstandingExpectation();
$httpBackend.verifyNoOutstandingRequest();
This would pass the test even though the expectations were never triggered.
Here is an example of the code I was testing with.