Sha256: a12955b00d0795e7083ee81fcf7f48358f240547f53e2153a29b7a5376422a6a

Contents?: true

Size: 1.12 KB

Versions: 10

Compression:

Stored size: 1.12 KB

Contents

import React from 'react';
import { IntegrationTestHelper } from 'react-redux-test-utils';
import API from 'foremanReact/API';
import ExcludePackagesSwitcher from '../index';
import reducers from '../../../../ForemanRhCloudReducers';

global.URL_PREFIX = '';

jest.mock('foremanReact/API');
API.post.mockImplementation(async () => ({
  data: {
    excludePackages: false,
  },
}));

jest.mock('../../AccountList/AccountListSelectors', () => ({
  selectExcludePackages: jest.fn(() => true),
}));

describe('ExcludePackagesSwitcher integration test', () => {
  it('should flow', async () => {
    const integrationTestHelper = new IntegrationTestHelper(reducers);
    const wrapper = integrationTestHelper.mount(<ExcludePackagesSwitcher />);
    const switcher = wrapper.find('Switch').first();
    switcher.props().onChange();
    await IntegrationTestHelper.flushAllPromises();
    wrapper.update();
    integrationTestHelper.takeStoreAndLastActionSnapshot(
      'switcher was toggled'
    );
    expect(API.post).toBeCalledWith(
      '/foreman_inventory_upload/installed_packages_inclusion',
      {
        value: false,
      }
    );
  });
});

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
foreman_rh_cloud-1.0.18 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.17 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.16 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.15 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.14 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-0.9.14 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-0.9.13.1 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.13.1 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-0.9.13 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-1.0.13 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js