I think "only mock what you own" relates to the data you own, not the
database client library.

On Mar 11, 10:42 am, Lothar Pfeiler <[email protected]> wrote:
> I prefer to have 3 databases. A sandbox database with some sample
> data, the production system with the real data and a QA database,
> which is a copy of the production system. This is how I have developed
> since 12 years and I didn't find a better solution.
>
> On Mar 11, 8:50 am, Roly Fentanes <[email protected]> wrote:
>
>
>
>
>
>
>
> > Like Ian said, most people create a test database.
>
> > but ideally it is much faster and better to use a mocked database. It's
> > easiest for couchdb since it uses http to communicate. For that you could
> > usehttps://github.com/flatiron/nock
>
> > you don't even have to mock the connection. if you know the database module
> > you're using is well tested, mock that module.
>
> >http://howtonode.org/testing-private-state-and-mocking-deps
>
> > On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> > > I've got an object named UserRepository which has a method named find
> > > which uses node-mysql to fetch rows from the database and I'm confused on
> > > how to test this code. I've tried reading about mocks but I still can't
> > > figure out exactly how to test the code. How do you  test code which talks
> > > to a database?
>
> > > I've also read "only mock what you own" and since I don't own node-mysql
> > > client I'm not sure what to do.
>
> > > Would really appreciate examples.
>
> > > Thanks,
>
> > > -Martin
>
> > On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> > > I've got an object named UserRepository which has a method named find
> > > which uses node-mysql to fetch rows from the database and I'm confused on
> > > how to test this code. I've tried reading about mocks but I still can't
> > > figure out exactly how to test the code. How do you  test code which talks
> > > to a database?
>
> > > I've also read "only mock what you own" and since I don't own node-mysql
> > > client I'm not sure what to do.
>
> > > Would really appreciate examples.
>
> > > Thanks,
>
> > > -Martin
>
> > On Saturday, March 10, 2012 4:31:21 PM UTC-7, Martin Lundberg wrote:
>
> > > I've got an object named UserRepository which has a method named find
> > > which uses node-mysql to fetch rows from the database and I'm confused on
> > > how to test this code. I've tried reading about mocks but I still can't
> > > figure out exactly how to test the code. How do you  test code which talks
> > > to a database?
>
> > > I've also read "only mock what you own" and since I don't own node-mysql
> > > client I'm not sure what to do.
>
> > > Would really appreciate examples.
>
> > > Thanks,
>
> > > -Martin

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