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

Version Path
katello-4.14.2 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.15.0 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.15.0.rc2 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.15.0.rc1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.0 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.0.rc3 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.0.rc2 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.0.rc1.1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.14.0.rc1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.13.1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.13.0 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.12.1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.13.0.rc1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.12.0 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.12.0.rc3 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.12.0.rc2 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.12.0.rc1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.11.1 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js
katello-4.11.0 webpack/scenes/Subscriptions/Details/__tests__/SubscriptionDetailActions.test.js