test('dispatches fetchUsersByNameSuccess on success', function () { const fetchSpy = this.spy(SearchFormActions, 'fetchUsersByNameSuccess'); const promise = this.dispatchSpy(SearchFormActions.getNameOptions('graders', 'Norval')); return promise.then(() => { strictEqual(fetchSpy.callCount, 1); }); });
test('dispatches fetchUsersByNameFailure on failure', function () { this.getUsersByNameStub.returns(Promise.reject(new Error('FAIL'))); const fetchSpy = this.spy(SearchFormActions, 'fetchUsersByNameFailure'); const promise = this.dispatchSpy(SearchFormActions.getNameOptions('graders', 'Norval')); return promise.then(() => { strictEqual(fetchSpy.callCount, 1); }); });
getNameOptions: (userType, searchTerm) => { dispatch(SearchFormActions.getNameOptions(userType, searchTerm)); },