try sinonjs it works perfectly for me. http://sinonjs.org/

Am Montag, 22. Oktober 2012 20:46:14 UTC+2 schrieb Modika:
>
> Hi All,
>
> Firstly apologies for some of the terminology here, i am coming from an MS 
> stack into Node so some of my language is still stuck there. I am just 
> getting into node, and improving my javascript along the way, and all the 
> community driven stuff is really great.
>
> I am using Mocha and should for my unit test
>
> One issue i am having is mocking the class which deals with the data 
> connections to the database.  I currently have an *Account *data access 
> object that deals with accounts in the database, this requires a *Database 
> *object which deals with the link to the database and running the 
> queries.  What i would like to do is mock the *Database *requires when 
> testing the *Account *object in isolation.
>
> i tried to use the node-sandboxed-module from Felix Geisendorfer, but i am 
> not sure if i was using it incorrectly, as it sandboxed the object 
> perfectly but then all my should asserts would stop working???.  I also 
> took a look at his other module Gently, but i am gonna be honest i didn't 
> fully understand its usage in my scenario, probably me being dim.
>
> Are there any good examples or best practices for this sort of thing?
>
> Thanks,
>
> Rob 
>
>

-- 
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 [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to