diff --git a/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx b/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx index 2a89f2fd92..e19d20ed66 100644 --- a/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx +++ b/plugins/catalog/src/components/AboutCard/AboutContent.test.tsx @@ -24,6 +24,14 @@ import { renderInTestApp } from '@backstage/test-utils'; import { screen } from '@testing-library/react'; import React from 'react'; import { AboutContent } from './AboutContent'; +import { CatalogApi } from '@backstage/catalog-client'; +import { ApiProvider } from '@backstage/core-app-api'; + +const catalogApi: jest.Mocked = { + getEntityByRef: jest.fn(), +} as any; + +const apis = TestApiRegistry.from([catalogApiRef, catalogApi]); describe('', () => { describe('An unknown entity', () => { @@ -63,11 +71,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -93,11 +106,16 @@ describe('', () => { entity.spec = {}; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -148,11 +166,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -185,11 +208,16 @@ describe('', () => { delete entity.spec!.system; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -253,11 +281,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -293,11 +326,16 @@ describe('', () => { delete entity.spec!.system; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -349,11 +387,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -376,11 +419,16 @@ describe('', () => { delete entity.metadata.tags; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -421,11 +469,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -453,11 +506,16 @@ describe('', () => { delete entity.metadata.tags; delete entity.spec!.type; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -509,11 +567,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -542,11 +605,16 @@ describe('', () => { delete entity.spec!.system; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -600,11 +668,16 @@ describe('', () => { }); it('renders info', async () => { - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent( @@ -631,11 +704,16 @@ describe('', () => { delete entity.spec!.domain; entity.relations = []; - await renderInTestApp(, { - mountedRoutes: { - '/catalog/:namespace/:kind/:name': entityRouteRef, + await renderInTestApp( + + + , + { + mountedRoutes: { + '/catalog/:namespace/:kind/:name': entityRouteRef, + }, }, - }); + ); expect(screen.getByText('Description')).toBeInTheDocument(); expect(screen.getByText('Description').nextSibling).toHaveTextContent(