Sha256: 74a080d60e675a72bd27f20451015f8c720ca8ed75767067188f133c7937485c

Contents?: true

Size: 1.39 KB

Versions: 100

Compression:

Stored size: 1.39 KB

Contents

import thunk from 'redux-thunk';
import Immutable from 'seamless-immutable';
import configureMockStore from 'redux-mock-store';
import { mockRequest, mockErrorRequest, mockReset } from '../../../mockRequest';
import { getAnsibleCollections } from '../AnsibleCollectionsActions';
import {
  ansibleCollectionsErrorActions,
  ansibleCollectionsSuccessActions,
  results,
} from './AnsibleCollections.fixtures';

const mockStore = configureMockStore([thunk]);
const store = mockStore({ ansibleCollections: Immutable({}) });
const endpoint = '/katello/api/v2/ansible_collections';

afterEach(() => {
  store.clearActions();
  mockReset();
});

describe('ansible collections actions', () => {
  describe('getAnsibleCollections', () => {
    it(
      'creates ANSIBLE_COLLECTIONS_REQUEST and then fails with 500 on bad request',
      async () => {
        mockErrorRequest({
          url: endpoint,
        });
        await store.dispatch(getAnsibleCollections());
        expect(store.getActions())
          .toEqual(ansibleCollectionsErrorActions);
      },
    );

    it(
      'creates ANSIBLE_COLLECTIONS_REQUEST and then return successfully',
      async () => {
        mockRequest({
          url: endpoint,
          response: results,
        });
        await store.dispatch(getAnsibleCollections());
        expect(store.getActions())
          .toEqual(ansibleCollectionsSuccessActions);
      },
    );
  });
});

Version data entries

100 entries across 100 versions & 1 rubygems

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