Any update for this? I have same problem.
On Tuesday, March 12, 2013 7:47:40 PM UTC-4, Nicolas Laplante wrote:
>
> I ended up overwriting the $routeProvider before each test like this. I
> don't get unexpected requests now. I don't know if it's the right way to do
> it but it works.
>
> Anyone?
>
> beforeEach(function() {
>
> module('myApp');
>
> // Overwrite $routeProvider to disallow resolving default routes
> // when testing browser is launched
>
> module(function($provide) {
> $provide.provider("$route", {
> $get : function() {},
> when : function() {},
> otherwise : function() {}
> });
> });
> });
>
> On Friday, March 8, 2013 10:32:44 AM UTC-5, Nicolas Laplante wrote:
>>
>> Hi all,
>>
>> My app is configured to use a resolve() for its main route ("/"). In this
>> resolve function I use $http to make an AJAX request.
>>
>> In my service unit test, I write the correct $httpBackend.expect...()
>> functions but I get errors at the end of the test because there were more
>> AJAX calls than expected. I think it happens because when PhantomJS is
>> launched by the test runner, it hits the main route (/) and the resolve
>> function fires and makes the AJAX request.
>>
>> How can I isolate the service AJAX calls from those made in the resolve()
>> function of the main route?
>>
>
--
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.