Sha256: 2d65dda6ed55e7e9c3c813f1d96a1ee366449d3830f9151e42ad8ab836aa57b7
Contents?: true
Size: 1.43 KB
Versions: 152
Compression:
Stored size: 1.43 KB
Contents
import thunk from 'redux-thunk'; import Immutable from 'seamless-immutable'; import configureMockStore from 'redux-mock-store'; import { mockRequest, mockErrorRequest, mockReset } from '../../../../mockRequest'; import { loadSubscriptionDetails } from '../SubscriptionDetailActions'; import { loadSubscriptionsDetailsSuccessActions, loadSubscriptionsDetailsFailureActions, subDetails, } from './subscriptionDetails.fixtures'; const mockStore = configureMockStore([thunk]); const store = mockStore({ subscriptionDetails: Immutable({}) }); const endpoint = /\/organizations\/\d+\/subscriptions\/\d+/; afterEach(() => { store.clearActions(); mockReset(); }); describe('subscription detail actions', () => { describe('loadSubscriptionDetails', () => { it( 'creates SUBSCRIPTION_DETAILS_REQUEST and then fails with 500', async () => { mockErrorRequest({ url: endpoint, }); await store.dispatch(loadSubscriptionDetails(1)); expect(store.getActions()) .toEqual(loadSubscriptionsDetailsFailureActions); }, ); it( 'creates SUBSCRIPTION_DETAILS_SUCCESS and ends with success', async () => { mockRequest({ url: endpoint, response: subDetails, }); await store.dispatch(loadSubscriptionDetails(1)); expect(store.getActions()) .toEqual(loadSubscriptionsDetailsSuccessActions); }, ); }); });
Version data entries
152 entries across 152 versions & 1 rubygems