trulia/thoth-api — pull request #19 by derekr (2014-12-17 05:45:50+00:00)
Title: Adds test for /server resource

Initial stab at adding basic integration tests. Currently this only tests the `/api/server*` route by checking for a `200` ok response from `tooth-api` and that the response object from `toth-index` is flattened.

```js
{ response: { numFound: 0, start: 0, docs: [] }
```
would be
```js
{ numFound: 0, start: 0, docs: [] }
```

Let me know if my assumption of the `thoth-index` response handling is correct.

The tests are generic enough that you could run against an actual running `thoth-index` and not change the port to `3002` as the readme suggest.

## Convention

Integration tests would go under `/tests/integration` and naming the resource w/ the request type being tested.
So testing a `GET` request against the `/api/server*` resource would be `/server-get.js`.

## Modules

Using [tap](https://www.npmjs.com/package/tap) for testing because it's super simple. Added [request](https://github.com/request/request) to simplify the request handling in tests, though it might be worth looking in to using `request` instead of `http` in the `dispatcher` modules.