Sha256: d7d19f6d91a6cbc2bd3e16bf1baa9324c6043647c9f35564aadb8421aeecb1e2

Contents?: true

Size: 1.09 KB

Versions: 9

Compression:

Stored size: 1.09 KB

Contents

import React from 'react';
import { IntegrationTestHelper } from '@theforeman/test';
import API from 'foremanReact/API';
import ExcludePackagesSwitcher from '../index';
import reducers from '../../../../ForemanRhCloudReducers';

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

9 entries across 9 versions & 1 rubygems

Version Path
foreman_rh_cloud-2.0.18.1 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.18 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.17 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.16 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.15 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-3.0.14 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.14 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.13.1 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js
foreman_rh_cloud-2.0.13 webpack/ForemanInventoryUpload/Components/ExcludePackagesSwitcher/__tests__/integration.test.js