Sha256: ca33e5be1e6a5ade45665f342959765cab4a56050b97cef9b0cba16c20a4e6c1

Contents?: true

Size: 1.27 KB

Versions: 29

Compression:

Stored size: 1.27 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

29 entries across 29 versions & 1 rubygems

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