On Sunday, March 25, 2012 5:39:23 AM UTC+2, Rehan Iftikhar wrote: > > Hi Martin > > I was asking myself these very same questions about a year ago. What > really helped me get my head around unit testing was to read Misko > Hevery's guide to testable code: http://bit.ly/GNymAe. While the > examples are in Java, the same principles apply: embrace the Single > Responsiblity Principle (SRP), leverage Dependency Injection (DI), and > isolate logic using Mock Objects. > > I test-drove an example of a UserAuthenticator class using these ideas > here: http://bit.ly/GNmDeQ. I tried to emulate your dependencies as > much as possible (UserRepository class). It uses Jasmine for the unit > tests. You > can use jasmine-node > (https://github.com/mhevery/​jasmine-node<https://github.com/mhevery/jasmine-node>) > > to run > these locally. > > -Rehan >
Hi Rehan! Thanks for the link and code, I'll definitely read throught the guide by Misko Hevery and look through your code. I see that you use events for almost everything, do you believe that you should use events as much as possible instead of callbacks? -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en