Sha256: 4a27fea23c432588a0bcc3ae6d1c65a462314d11db865ca706b12ff501bb56d9
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
import React from 'react'; import { IntegrationTestHelper } from '@theforeman/test'; import { API } from 'foremanReact/redux/API'; import ExcludePackagesSwitcher from '../index'; import reducers from '../../../../ForemanRhCloudReducers'; jest.mock('foremanReact/redux/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
3 entries across 3 versions & 1 rubygems