Sha256: 6918fa93d8755647bc93a717c944fed748a3434d4b7049c831cf86650d5262f3

Contents?: true

Size: 1.64 KB

Versions: 120

Compression:

Stored size: 1.64 KB

Contents

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

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

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

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

  it('should flatten organization response GET_ORGANIZATION_SUCCESS', () => {
    expect(reducer(initialState, {
      type: types.GET_ORGANIZATION_SUCCESS,
      response: requestSuccessResponse,
    })).toEqual(successState);
  });

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

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

  it('should flatten organization response SAVE_ORGANIZATION_SUCCESS', () => {
    expect(reducer(initialState, {
      type: types.SAVE_ORGANIZATION_SUCCESS,
      response: requestSuccessResponse,
    })).toEqual(successState);
  });

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

Version data entries

120 entries across 120 versions & 1 rubygems

Version Path
katello-4.2.2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.3.0.rc1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.0.1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.4 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.0.3 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.0.1.rc3 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-3.18.5 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.0.1.rc2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.0.rc2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.3 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.2.0.rc1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.0.2.1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.2.1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.0.2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-3.18.4 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.1 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.1.0 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js
katello-4.0.1.2 webpack/scenes/Organizations/__tests__/OrganizationReducer.test.js