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.11.0.rc2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.11.0.rc1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.0 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.0.rc1.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.9.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.10.0.rc1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.9.0 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.8.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.9.0.rc2 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.9.0.rc1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.7.1.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.7.1 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.8.0 webpack/scenes/Products/__tests__/ProductActions.test.js
katello-3.8.0.rc3 webpack/scenes/Products/__tests__/ProductActions.test.js