Cleanup tests

Major test cleanup. I moved all files used by the tests into `test/fixtures`. I also removed duplicate tests and moved some of them into `api.js`.