Sha256: 61370546e098240a04fbd8d13fd56595ebed1b51fc629d8928ebc5ac96f1934e

Contents?: true

Size: 1.17 KB

Versions: 34

Compression:

Stored size: 1.17 KB

Contents

import thunk from 'redux-thunk';
import Immutable from 'seamless-immutable';
import configureMockStore from 'redux-mock-store';
import { mock, mockRequest, mockErrorRequest } from '../../../mockRequest';
import {
  failureActions,
  successActions,
  requestSuccessResponse,
} from './products.fixtures';
import { loadProducts } from '../ProductActions';

const mockStore = configureMockStore([thunk]);
const store = mockStore({ e: Immutable({}) });

beforeEach(() => {
  store.clearActions();
  mock.reset();
});

describe('product actions', () => {
  describe('loadProducts', () => {
    it('handles failed PRODUCTS_REQUEST', () => {
      mockErrorRequest({
        url: '/katello/api/v2/organizations/1/products/',
        status: 422,
      });
      return store.dispatch(loadProducts())
        .then(() => expect(store.getActions()).toEqual(failureActions));
    });

    it('handles successful PRODUCTS_REQUEST', () => {
      mockRequest({
        url: '/katello/api/v2/organizations/1/products/',
        response: requestSuccessResponse,
      });
      return store.dispatch(loadProducts())
        .then(() => expect(store.getActions()).toEqual(successActions));
    });
  });
});

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
katello-3.13.4 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.3 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.0 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.0.rc2.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.0.rc2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.3 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.13.0.rc1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.11.2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.0 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.0.rc2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.1.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.12.0.rc1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.11.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.11.0 webpack/scenes/Products/__tests__/ProductActions.test.js