christianbundy/node-hacker-news-api — pull request #4 by euank (2014-05-22 04:05:35+00:00)
Title: Escape args, add some tests

So, the first commit fixes the fact that some (most) queries were not url encoded. querystring.stringify automatically does encodeURIComponent on elements, but any parts of the path also need to be encoded, not just the querystring for `.search`, so this reworks everything a bit to make that cleaner to implement.

An easy example of this bug would be:
```javascript
hn.searchStories('apple # google', function(err, data) {
console.log(data.hits[0].title);
});
```
Before it would return "Steve Jobs Resigns as CEO of Apple". Now it returns "Apple Google #locationgate: just ask for permission?" which makes significantly more sense for the query.

The second commit is just a boring set of tests. Mocked out api, fixture, only tests the first few calls, etc etc.