Hi,
I wrote a Angular service that encapsulates calls to REST services.
This service adds some parameters to the URL and I want to write a unit
test that verifies these parameters were added as expected.
I use $httpBackend to mock the HTTP request in my test, but I can't find a
way to see the URL that was called.
Here is the unit test I wrote :
it(" - Appel d'un service public", inject(function ($rootScope,
$httpBackend, RestService) {
$httpBackend.when('JSONP').respond(jsonSuccess);
var resolvedValue;
var promise = RestService.call('/rest/test');
promise.then(function (value) {
resolvedValue = value;
});
$httpBackend.flush();
$rootScope.$apply();
expect(resolvedValue).toBe("myData");
// Need something like that
expect($httpBackend.url.locale).toBe('fr');
}));
Thanks for any help !
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.