Stebon24/redwrap — pull request #7 by bensheldon (2012-12-13 23:53:20+00:00)
Title: Initial testing setup

This pull request adds mocha, chai.expect and sinon for BDD style testing. It also provides 2 simple example tests for the `reddit.user()` method, one of which currently passes, and the other fails (the bare username method creates a malformed---though apparently functional to the reddit API--- URL).

Let me know if the basic format makes sense. Basically:

1. Stub the `request` function so it doesn't actually make an http request to the reddit API
2. Mock a fake response from the Reddit API
3. Assert that the request is correctly formed by spying on our stubbed request
4. Assert that our callback is correctly formatted (or handles errors, or whatever)

You'll get the hang of it. Writing tests are easier than you think and it's waaaaay easier than console.logging everything (heck, put the `console.log` statements in your test and spy on what's happening without having to crud up your library functions). Also, [sinon](http://sinonjs.org/) is totally badass for injecting fake data and spying on the results.

Addresses #3