Simplify the setup code used to create mock requests. Remove all shared state across tests. Convert mock requests to return promises for easy asynchronous testing. There should be no need now to use before or beforeEach blocks...
...which makes this possible: Moved describe and it blocks around so that it should be clearer 1) what tests go where, and 2) what is being tested.
I think there are still some holes in the test suite, but I think this new setup should make it easier to find and fix them.
For the sake of reviewers (@bithavoc and @floatingLomas), I thought it would be nicer to have the commits separated. I'll squash before merge/whenever if someone wants it squashed sooner.
(Hopefully) fixes #60.
Simplify the setup code used to create mock requests. Remove all shared state across tests. Convert mock requests to return promises for easy asynchronous testing. There should be no need now to use
before
orbeforeEach
blocks......which makes this possible: Moved
describe
andit
blocks around so that it should be clearer 1) what tests go where, and 2) what is being tested.I think there are still some holes in the test suite, but I think this new setup should make it easier to find and fix them.
For the sake of reviewers (@bithavoc and @floatingLomas), I thought it would be nicer to have the commits separated. I'll squash before merge/whenever if someone wants it squashed sooner.