Sha256: 9af358b618513bd0e1d14823b68585e706a6a6e036c258596261bf446b409464

Contents?: true

Size: 1.09 KB

Versions: 181

Compression:

Stored size: 1.09 KB

Contents

import {
  MODULE_STREAMS_REQUEST,
  MODULE_STREAMS_SUCCESS,
  MODULE_STREAMS_FAILURE,
} from '../ModuleStreamsConstants';
import {
  initialState,
  loadingState,
  successState,
  results,
} from './moduleStreams.fixtures';
import reducer from '../ModuleStreamsReducer';

describe('module streams reducer', () => {
  it('should return the initial state', () => {
    expect(reducer(undefined, {})).toEqual(initialState);
  });

  it('should keep loading state on MODULE_STREAMS_REQUEST', () => {
    expect(reducer(initialState, {
      type: MODULE_STREAMS_REQUEST,
    })).toEqual(loadingState);
  });

  it('load module streams on MODULE_STREAMS_SUCCESS', () => {
    expect(reducer(initialState, {
      type: MODULE_STREAMS_SUCCESS,
      response: {
        ...initialState,
        results,
      },
    })).toEqual(successState);
  });

  it('load error on MODULE_STREAMS_FAILURE', () => {
    const error = 'nothing worked';
    expect(reducer(initialState, {
      type: MODULE_STREAMS_FAILURE,
      error,
    })).toEqual({
      ...initialState,
      loading: false,
      error,
    });
  });
});

Version data entries

181 entries across 181 versions & 1 rubygems

Version Path
katello-4.0.0 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-4.0.0.rc3.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-4.0.0.rc3 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.2.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.3 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-4.0.0.rc2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.1.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-4.0.0.rc1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.0 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.16.2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.0.rc2.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.0.rc2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.0 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.18.0.rc1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.0.rc2.2 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js
katello-3.17.0.rc2.1 webpack/scenes/ModuleStreams/__tests__/ModuleStreamsReducer.test.js