Sha256: 191a90255f427f6fcaa18188e27d9ad33301d2f14fd07f881174533085b45181

Contents?: true

Size: 1.26 KB

Versions: 9

Compression:

Stored size: 1.26 KB

Contents

import * as types from '../../consts';

import {
  initialState,
  recommendedState,
  loadingState,
  requestSuccessResponse,
  successState,
  errorState,
} from './sets.fixtures';
import reducer from './sets';

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

  it('should update the recommended value on REPOSITORY_SETS_UPDATE_RECOMMENDED', () => {
    expect(reducer(initialState, {
      type: types.REPOSITORY_SETS_UPDATE_RECOMMENDED,
      payload: true,
    })).toEqual(recommendedState);
  });

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

  it('should flatten repositories response REPOSITORY_SETS_SUCCESS', () => {
    expect(reducer(initialState, {
      type: types.REPOSITORY_SETS_SUCCESS,
      payload: { response: requestSuccessResponse, search: requestSuccessResponse.search },
    })).toEqual(successState);
  });

  it('should have error on REPOSITORY_SETS_FAILURE', () => {
    expect(reducer(initialState, {
      type: types.REPOSITORY_SETS_FAILURE,
      payload: 'Unable to process request.',
    })).toEqual(errorState);
  });
});

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
katello-3.8.1 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.7.1.1 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.7.1 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.8.0 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.8.0.rc3 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.8.0.rc2 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.7.0 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.8.0.rc1 webpack/redux/reducers/RedHatRepositories/sets.test.js
katello-3.7.0.rc2 webpack/redux/reducers/RedHatRepositories/sets.test.js