Sha256: abad9c04f190c1d500d5ab53ce62f53b1a7dcb5bb110aad6dd524fe8a4769948

Contents?: true

Size: 1.31 KB

Versions: 150

Compression:

Stored size: 1.31 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: { response: { data: { error: { missing_permissions: ['unknown'] } } } },
    })).toEqual(errorState);
  });
});

Version data entries

150 entries across 150 versions & 1 rubygems

Version Path
katello-4.15.0.rc2 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.15.0.rc1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.0 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.0.rc3 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.0.rc2 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.0.rc1.1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.14.0.rc1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.13.1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.13.0 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.12.1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.13.0.rc1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.12.0 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.12.0.rc3 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.12.0.rc2 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.12.0.rc1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.11.1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.11.0 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.11.0.rc2 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js
katello-4.11.0.rc1 webpack/redux/reducers/RedHatRepositories/__tests__/sets.test.js