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