Fix JavaScript unit tests for 2.0.x.

A lot of the optimizations made resulted in broken unit tests, due to
various tests not accounting for throttled results.

We now optimistically disable throttling where possible (for cases where
the _.throttle call isn't part of the object's prototype) and do proper
async testing in the other cases.

Reviewed at https://reviews.reviewboard.org/r/6443/