I am using the Angular.js $httpBackend
to test some services that wrap $http
calls (this is in ngMock, not ngMockE2E).
It seems that things like expect
and when
are sensitive to the order of URL query parameters. E.g. if I do $httpBackend.when('POST','/apiCall?X=1&Y=2').respond(/* ... */)
or $httpBackend.expectPOST('/apiCall?X=1&Y=2')
, I get URL mismatches if I have Y=2&X=1 in the URL instead of X=1&Y=2.
I want to write my tests in such a way that the service being tested will be free to change the order of URL query string parameters without breaking the tests. I haven't been able to find anything to solve this in the $httpBackend documentation. What's the right way to do this?