Sha256: b924a9db434288094a964d659b4c46dd0eb4cd9b1ba16e1d79ab19ca21dd36d0

Contents?: true

Size: 1.52 KB

Versions: 149

Compression:

Stored size: 1.52 KB

Contents

import thunk from 'redux-thunk';
import Immutable from 'seamless-immutable';
import configureMockStore from 'redux-mock-store';
import { disableRepository, loadEnabledRepos } from '../enabled.js';
import { mock as mockApi } from '../../../../mockRequest';
import {
  ENABLED_REPOSITORIES_REQUEST,
  DISABLE_REPOSITORY_REQUEST,
} from '../../../consts';

const mockStore = configureMockStore([thunk]);
const store = mockStore({ e: Immutable({}) });

describe('RedHatRepositories enabled actions', () => {
  describe('disableRepository', () => {
    it('dispatches DISABLE_REPOSITORY_REQUEST', async () => {
      const mockRepo = { // don't need actual values because just checking that the action matches
        productId: 'some-product-id',
        contentId: 'some-content-id',
        basearch: 'some-base-search',
        releasever: 'some-releasever',
      };
      mockApi.onPut(`/products/${mockRepo.productId}/repository_sets/${mockRepo.contentId}/disable`).reply(200, []);

      await store.dispatch(disableRepository(mockRepo));
      expect(store.getActions()).toContainEqual({
        type: DISABLE_REPOSITORY_REQUEST,
        repository: mockRepo,
      });
    });
  });
  describe('loadEnabledRepos', () => {
    it('dispatches ENABLED_REPOSITORIES_REQUEST', async () => {
      mockApi.onGet('/repositories').reply(200, []);

      await store.dispatch(loadEnabledRepos());
      expect(store.getActions()).toContainEqual({
        type: ENABLED_REPOSITORIES_REQUEST,
        silent: false,
        params: {},
      });
    });
  });
});

Version data entries

149 entries across 149 versions & 1 rubygems

Version Path
katello-4.4.0.2 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.4.0.1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.4.0 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.4.0.rc2 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.4.0.rc1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.2.2 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0.rc4 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0.rc3 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0.rc2.1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0.rc2 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.3.0.rc1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.2.1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.2.0.1 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.1.4 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.0.3 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.2.0.1.rc3 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-3.18.5 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js
katello-4.2.0.1.rc2 webpack/redux/actions/RedHatRepositories/__tests__/enabled.test.js