Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"Installed Operators are represented by ClusterServiceVersions within this Namespace.": "Installed Operators are represented by ClusterServiceVersions within this Namespace.",
" For more information, see the <3>Understanding Operators documentation</3>. Or create an Operator and ClusterServiceVersion using the <6>Operator SDK</6>.": " For more information, see the <3>Understanding Operators documentation</3>. Or create an Operator and ClusterServiceVersion using the <6>Operator SDK</6>.",
"Required": "Required",
"No description available": "No description available",
"Create instance": "Create instance",
"No Kubernetes APIs are being provided by this Operator.": "No Kubernetes APIs are being provided by this Operator.",
"{{initializationResourceKind}} required": "{{initializationResourceKind}} required",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ jest.mock('../../utils/useClusterServiceVersionPath', () => ({

jest.mock('@console/internal/components/utils', () => ({
...jest.requireActual('@console/internal/components/utils'),
AsyncComponent: ({ children }) => children || null,
AsyncComponent: ({ content, emptyMsg }) => <span>{content || emptyMsg || null}</span>,
}));

jest.mock('@console/internal/components/conditions', () => ({
Expand Down Expand Up @@ -276,6 +276,21 @@ describe('CRDCard', () => {

expect(screen.queryByRole('link', { name: 'Create instance' })).not.toBeInTheDocument();
});

it('renders crd description when provided', () => {
const crdWithDescription = { ...crd, description: 'This is a test CRD description' };
renderWithProviders(<CRDCard {...crdCardProps} crd={crdWithDescription} />);

expect(screen.getByText('This is a test CRD description')).toBeVisible();
});

it('renders "No description available" when crd description is missing', () => {
const crdWithoutDescription = { ...crd };
delete crdWithoutDescription.description;
renderWithProviders(<CRDCard {...crdCardProps} crd={crdWithoutDescription} />);

expect(screen.getByText('No description available')).toBeVisible();
});
});

describe('CSVSubscription', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -825,6 +825,7 @@ export const MarkdownView = (props: {
styles?: string;
exactHeight?: boolean;
truncateContent?: boolean;
emptyMsg?: string;
}) => {
return (
<AsyncComponent
Expand Down Expand Up @@ -867,7 +868,11 @@ export const CRDCard: FC<CRDCardProps> = ({ csv, crd, required, ...rest }) => {
</span>
</CardTitle>
<CardBody>
<MarkdownView content={crd.description} truncateContent />
<MarkdownView
content={crd.description}
truncateContent
emptyMsg={t('olm~No description available')}
/>
</CardBody>
{canCreate && createRoute && (
<RequireCreatePermission model={model} namespace={csv.metadata.namespace}>
Expand Down