Sha256: 28d7c32ffeedbfbfec610164fe83fdf5548c00faf4055f769967e8dda379f776

Contents?: true

Size: 1.35 KB

Versions: 29

Compression:

Stored size: 1.35 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 { getModuleStreams } from '../ModuleStreamsActions';
import {
  moduleStreamsFailureActions,
  moduleStreamsSuccessActions,
  results,
} from './moduleStreams.fixtures';

const mockStore = configureMockStore([thunk]);
const store = mockStore({ moduleStreams: Immutable({}) });
const endpoint = '/katello/api/v2/module_streams';

afterEach(() => {
  store.clearActions();
  mockReset();
});

describe('module stream actions', () => {
  describe('getModuleStreams', () => {
    it(
      'creates MODULE_STREAMS_REQUEST and then fails with 500 on bad request',
      () => {
        mockErrorRequest({
          url: endpoint,
        });
        return store.dispatch(getModuleStreams())
          .then(() => expect(store.getActions())
            .toEqual(moduleStreamsFailureActions));
      },
    );

    it(
      'creates MODULE_STREAMS_REQUEST and then return successfully',
      () => {
        mockRequest({
          url: endpoint,
          response: results,
        });
        return store.dispatch(getModuleStreams())
          .then(() => expect(store.getActions())
            .toEqual(moduleStreamsSuccessActions));
      },
    );
  });
});

Version data entries

29 entries across 29 versions & 1 rubygems

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