Sounds like you are struggling with $httpBackend.
Do you have a line like this?
1. $httpBackend.when('GET', '/url/to/service').respond({userId: 'userX'},
{'A-Token': 'xxx'});
2.
On Mon, Dec 23, 2013 at 3:56 PM, Sergio Rinaudo <[email protected]>wrote:
> Could you provide a simple example?
>
> Currently, I have something like this
>
> - A LoggedInLoader that is a Service that returns a promise.
> - This service is called in the run block
>
>
> If a try to run tests I get this error
>
> Error: Unexpected request: GET /url/to/service
> No more request expected in
> app/bower_components/angular-mocks/angular-mocks.js (line 960)
>
> I am really stuck here...
>
>
>
>
> 2013/12/23 Clint Checketts <[email protected]>
>
>> If you had an InitializationService that did all this work, then it would
>> easy to test like any other service, and the run block would be simplified
>> to merely calling the Init service.
>>
>>
>> On Sun, Dec 22, 2013 at 5:27 PM, Sergio Rinaudo <[email protected]
>> > wrote:
>>
>>> Hi all,
>>> I have some logic in the run block of my app
>>>
>>> *file app.js*
>>> app.config(
>>> // routes etc..
>>> )..run(
>>> // logic here
>>> );
>>>
>>> this logic have to run only once when the user enters the app,
>>> for example an async request to get the user session data.
>>>
>>> I would like to set up tests for this block, but after lots of searching
>>> I
>>> couldn't find any way to do so.
>>>
>>> I would like to follow all the best practices, so, the first question
>>> is,
>>> is the run block the correct point to do this kind of checking?
>>> If not, what would be a better solution?
>>> Please note that I did not use the resolve property because the
>>> application needs this checking
>>> in every module but just once (when the use enter th app, that could be
>>> any controller).
>>>
>>> I hope that someone could enlight me!
>>>
>>> Regards
>>>
>>>
>>> --
>>> 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/groups/opt_out.
>>>
>>
>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "AngularJS" group.
>> To unsubscribe from this topic, visit
>> https://groups.google.com/d/topic/angular/QqrpFe8kSr0/unsubscribe.
>> To unsubscribe from this group and all its topics, 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/groups/opt_out.
>>
>
> --
> 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/groups/opt_out.
>
--
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/groups/opt_out.