Sha256: cea3d96ffdb4edc550dbf04c69d2d20650897a776dccc8f71e97844a973360c2
Contents?: true
Size: 1.82 KB
Versions: 128
Compression:
Stored size: 1.82 KB
Contents
import * as types from '../UpstreamSubscriptionsConstants'; import { initialState, loadingState, requestSuccessResponse, taskSuccessResponse, successState, errorState, saveSuccessState, initialSaveState, saveErrorState, } from './upstreamSubscriptions.fixtures'; import reducer from '../UpstreamSubscriptionsReducer'; describe('upstream subscriptions reducer', () => { const errorResult = { response: { data: 'Unable to process request.', }, }; it('should return the initial state', () => { expect(reducer(undefined, {})).toEqual(initialState); }); it('should keep loading state on UPSTREAM_SUBSCRIPTIONS_REQUEST', () => { expect(reducer(initialState, { type: types.UPSTREAM_SUBSCRIPTIONS_REQUEST, })).toEqual(loadingState); }); it('should flatten subscriptions response UPSTREAM_SUBSCRIPTIONS_SUCCESS', () => { expect(reducer(initialState, { type: types.UPSTREAM_SUBSCRIPTIONS_SUCCESS, response: requestSuccessResponse, })).toEqual(successState); }); it('should have error on UPSTREAM_SUBSCRIPTIONS_FAILURE', () => { expect(reducer(initialState, { type: types.UPSTREAM_SUBSCRIPTIONS_FAILURE, payload: { message: 'Unable to process request.', }, })).toEqual(errorState); }); it('should flatten response SAVE_UPSTREAM_SUBSCRIPTIONS_SUCCESS', () => { expect(reducer(initialSaveState, { type: types.SAVE_UPSTREAM_SUBSCRIPTIONS_SUCCESS, response: taskSuccessResponse, })).toEqual(saveSuccessState); }); it('should have error on SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE', () => { expect(reducer(initialSaveState, { type: types.SAVE_UPSTREAM_SUBSCRIPTIONS_FAILURE, payload: { message: 'Unable to process request.', result: errorResult, }, })).toEqual(saveErrorState); }); });
Version data entries
128 entries across 128 versions & 1 rubygems