I writing some unit tests for my angularjs app. For the tests I'm mocking the $http request with the internal $httpBackend.
During the test I use the $httpBackend.expectGET, because I want the exact behavior of my app request.
For example I have an Params-Object:
parameters = {
name : 'Monkey',
crazy : false,
desc : 'Nobody',
};
The Http-Get request in my app is:
return $http.get(this.uri + '/' + id, {params : parameters});
At my unit-test I expect this:
$httpBackend.expectGET(instance.uri + '/' + returnValues.id + '?' + query).respond(200, object);
"query" is only the elements of the object concat with '=' and '&'. So I expect the URL:
http://ift.tt/1yq5Z5H
But I get this one:
http://ift.tt/1apUGyS
Does $http make a sort on basis of the keys in the object for the "params"?
Aucun commentaire:
Enregistrer un commentaire