Sha256: 234a2cf1c69b50ea233cdd91dae9167243a139e371327647188dfc903190da87

Contents?: true

Size: 1.15 KB

Versions: 100

Compression:

Stored size: 1.15 KB

Contents

import {
  ANSIBLE_COLLECTIONS_REQUEST,
  ANSIBLE_COLLECTIONS_SUCCESS,
  ANSIBLE_COLLECTIONS_ERROR,
} from '../AnsibleCollectionsConstants';
import {
  initialState,
  loadingState,
  successState,
  results,
} from './AnsibleCollections.fixtures';
import reducer from '../AnsibleCollectionsReducer';

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

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

  it('load ansible collections on ANSIBLE_COLLECTIONS_SUCCESS', () => {
    expect(reducer(initialState, {
      type: ANSIBLE_COLLECTIONS_SUCCESS,
      response: {
        ...initialState,
        results,
      },
    })).toEqual(successState);
  });

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

Version data entries

100 entries across 100 versions & 1 rubygems

Version Path
katello-4.4.2.2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.2.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.5.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.5.0 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.5.0.rc2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.5.0.rc1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.0.2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.0.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.0 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.0.rc2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.4.0.rc1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.2.2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.0 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.0.rc4 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.0.rc3 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.0.rc2.1 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js
katello-4.3.0.rc2 webpack/scenes/AnsibleCollections/__tests__/AnsibleCollectionsReducer.test.js