clarify test actions

Signed-off-by: nikolar <reyna.nikolayev@autodesk.com>
This commit is contained in:
nikolar
2025-01-06 12:14:10 -08:00
parent f1a09dd40e
commit 85097cf492
3 changed files with 13 additions and 34 deletions
@@ -64,32 +64,6 @@ describe('Entity Info Card Grid', () => {
expect(await screen.findByText('TestTitle2')).toBeInTheDocument();
});
it('should handle missing data gracefully', async () => {
await renderInTestApp(
<InfoCardGrid
entities={[
{
apiVersion: 'version',
kind: 'TestKind',
metadata: {
name: 'testName',
},
spec: {
owner: 'techdocs@example.com',
},
},
]}
/>,
{
mountedRoutes: {
'/docs/:namespace/:kind/:name/*': rootDocsRouteRef,
},
},
);
expect(await screen.findByText('testName')).toBeInTheDocument();
});
it('should render links correctly', async () => {
await renderInTestApp(
<InfoCardGrid
@@ -14,13 +14,13 @@
* limitations under the License.
*/
import { rootDocsRouteRef } from '../../../routes';
import { toLowerMaybe } from '../../../helpers';
import React from 'react';
import { Entity } from '@backstage/catalog-model';
import { useApi, useRouteRef, configApiRef } from '@backstage/core-plugin-api';
import { ItemCardGrid, InfoCard, Link } from '@backstage/core-components';
import { makeStyles } from '@material-ui/core/styles';
import React from 'react';
import { rootDocsRouteRef } from '../../../routes';
import { toLowerMaybe } from '../../../helpers';
/** @public */
export type InfoCardGridClassKey = 'linkSpacer' | 'readMoreLink';
@@ -19,7 +19,7 @@ import {
starredEntitiesApiRef,
MockStarredEntitiesApi,
} from '@backstage/plugin-catalog-react';
import { PageWithHeader } from '@backstage/core-components';
import { ContentHeader, PageWithHeader } from '@backstage/core-components';
import { catalogApiMock } from '@backstage/plugin-catalog-react/testUtils';
import { renderInTestApp, TestApiRegistry } from '@backstage/test-utils';
import { screen } from '@testing-library/react';
@@ -113,7 +113,14 @@ describe('TechDocsCustomHome', () => {
title: 'First Tab',
description: 'First Tab Description',
panelType: 'DocsCardGrid' as PanelType,
panelProps: { CustomHeader: React.Fragment },
panelProps: {
CustomHeader: () => (
<ContentHeader
title="Custom Header"
description="useful docs"
/>
),
},
filterPredicate: () => true,
},
],
@@ -131,9 +138,7 @@ describe('TechDocsCustomHome', () => {
},
);
expect(
screen.queryByText('Discover documentation in your ecosystem.'),
).not.toBeInTheDocument();
expect(screen.getByText('Custom Header')).toBeInTheDocument();
});
it('should render CustomPageWrapper', async () => {
const tabsConfig = [