Skip to content

Commit

Permalink
Fixes #37240 - Fix CCV duplicate repo warning (Katello#10928)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-bucher committed Mar 13, 2024
1 parent 40a70ce commit 02fc313
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion webpack/scenes/ContentViews/Publish/CVPublishForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const CVPublishForm = ({
</Alert>)
}
{!duplicateReposAlertDismissed && composite &&
(duplicateRepos !== null || duplicateRepos.length > 0) &&
(duplicateRepos !== null && duplicateRepos.length > 0) &&
(
<Alert
ouiaId="duplicate-repos-alert"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import React from 'react';
import * as reactRedux from 'react-redux';
import { renderWithRedux, patientlyWaitFor, fireEvent, act } from 'react-testing-lib-wrapper';
import { screen } from '@testing-library/react';
import '@testing-library/jest-dom';

import { nockInstance, assertNockRequest } from '../../../../test-utils/nockWrapper';
import api from '../../../../services/api';
import PublishContentViewWizard from '../PublishContentViewWizard';
Expand Down Expand Up @@ -80,6 +83,33 @@ test('Can show wizard with duplicate repository warning for composite CV', async
assertNockRequest(filterScope, done);
});

test('Can show wizard without duplicate repository warning for composite CV', async (done) => {
const cvCompositeDetailsData = cvDetailData;
cvCompositeDetailsData.composite = true;
cvCompositeDetailsData.duplicate_repositories_to_publish = [];
const scope = nockInstance
.get(environmentPathsPath)
.query(true)
.reply(200, environmentPathsData);
const filterScope = nockInstance
.get(cvFiltersPath)
.reply(200, contentViewFilterData);

const { getByText } = renderWithRedux(<PublishContentViewWizard
details={cvCompositeDetailsData}
show
onClose={() => { }}
/>);

await patientlyWaitFor(() => {
expect(getByText('Publish new version - 6.0')).toBeInTheDocument();
expect(screen.queryByText('Repositories common to the selected content view versions will merge, resulting in a composite content view that is a union of all content from each of the content view versions.')).not.toBeInTheDocument();
});

assertNockRequest(scope);
assertNockRequest(filterScope, done);
});

test('Can show Wizard and show environment paths', async (done) => {
const scope = nockInstance
.get(environmentPathsPath)
Expand Down

0 comments on commit 02fc313

Please sign in to comment.