Sha256: 8baf981f3b927df93632b32cc9d45a6adf57025343497a7e3fd937af72840b1c

Contents?: true

Size: 1.34 KB

Versions: 44

Compression:

Stored size: 1.34 KB

Contents

import React from 'react';
import { cleanup } from '@testing-library/react';
import { renderWithRedux, fireEvent } from 'react-testing-lib-wrapper';
import ExportSyncForm from '../ExportSyncForm';
import { nockInstance, assertNockRequest } from '../../../../../test-utils/nockWrapper';
import { updateCdnConfigurationSuccessResponse } from '../../../../Organizations/__tests__/organizations.fixtures';
import { EXPORT_SYNC } from '../CdnConfigurationConstants';

import api from '../../../../../services/api';

afterEach(cleanup);
const updateCdnConfigurationPath = api.getApiUrl('/organizations/1/cdn_configuration');

const updateButtonName = 'update-airgapped-configuration';

const organization = {
  id: 1,
};

const initialState = {
  katello: {
    organization,
  },
};


test('Can update to Airgapped type', async (done) => {
  const { getByLabelText } = renderWithRedux(<ExportSyncForm
    typeChangeInProgress
  />, { initialState });

  const updateCdnConfigurationRequest = nockInstance
    .put(updateCdnConfigurationPath, {
      type: EXPORT_SYNC,
    })
    .reply(200, updateCdnConfigurationSuccessResponse);

  expect(getByLabelText(updateButtonName)).toHaveAttribute('aria-disabled', 'false');

  const updateButton = getByLabelText(updateButtonName);
  fireEvent.click(updateButton);
  assertNockRequest(updateCdnConfigurationRequest, done);
});

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
katello-4.7.1 webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/ExportSyncForm.test.js
katello-4.7.0 webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/ExportSyncForm.test.js
katello-4.7.0.rc2 webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/ExportSyncForm.test.js
katello-4.7.0.rc1 webpack/scenes/Subscriptions/Manifest/CdnConfigurationTab/__tests__/ExportSyncForm.test.js