0

I am getting errors thrown from $httpBackend saying

Error: Unexpected request: GET app/insured/search/inSearch.html
No more request expected
at $httpBackend ...

I have not setup any expectations, do not have verifyNoOutstandingExpectation() or verifyNoOutstandingRequest(), as a matter of fact I do not even have afterEach() in my tests?

epitka
  • 17,275
  • 20
  • 88
  • 141
  • Care to share the code that is causing the problem? – Sunil D. Mar 03 '15 at 15:55
  • 1
    Possible duplication: http://stackoverflow.com/questions/18147606/why-do-i-receive-error-unexpected-request-get-internalapi-quotes generally if you trigger a `$http` call you have to tell mocks that you expect it, otherwise .... it's Unexpected ;) – maurycy Mar 03 '15 at 15:55
  • @maurycy: even though I don't use $httpBacked, I don't set any expectations, in this case I don't care what it does. And also it is reporting call to html file. I have hundreds of html templates, I cannot possible setup expectation for each one, nor should I have to worry about that. – epitka Mar 03 '15 at 15:58
  • its a simple prevention system to make sure you don't mess up and create unexpected XHR request, your tests have to be aware of what's ok and what's not, you can pass it with `$httpBackend.whenGET(/html$/).passThrough()` just use regexp that suits you – maurycy Mar 03 '15 at 16:27
  • @maurycy: passThrough() is not available on the object at all at runtime. I read a comment on git that it is available only when doing e2e tests, not when doing unit tests. – epitka Mar 03 '15 at 17:01

0 Answers0