Currently, to unit test asynchronous actions we intercept all calls to wait and return our own promises that we then manipulate directly. This approach has issues as any call to jQuery.Promise#then et. al. returns a new instance of jQuery.Promise. If we were to return the promises from the action thunks, then this wouldn't be the case.
- The linkDwell thunk returns a promise.
- The abandon thunk returns a promise.
- The unit tests for the actions are updated to
- Unnecessary setTimeout(..., 0) and wait(0) in the tests are removed
- Unnecessary promise/deferreds coordination is removed in favor of just waiting for the promises from the functions to finish
- We can also remove the wait(0) in some of the tests since the action creators will return a promise that we can wait to, instead of having to hackily wait till next tick to check the assertions.
- Can we remove .fail in actions.js#L123?
- Clarify if we are using jQuery3 everywhere 2, as we couldn't remove it before since jquery3 wasn't rolled out everywhere.
- Notify the team if jQuery3 is rolled out to all projects now