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 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.
