Cleaned up the test a bit by using async.
Many changes:

1) More unit tests.

2) pouchdb-nightly had a bug (it was confusing startkey and endkey).
Upgraded to 2.1.0 and that's fixed.

3) Minor fixes and updates.