diff --git a/plugins/catalog-react/src/components/EntityRefLink/FetchedEntityRefLinks.test.tsx b/plugins/catalog-react/src/components/EntityRefLink/FetchedEntityRefLinks.test.tsx
index 0a3ea1003e..c416adcfbd 100644
--- a/plugins/catalog-react/src/components/EntityRefLink/FetchedEntityRefLinks.test.tsx
+++ b/plugins/catalog-react/src/components/EntityRefLink/FetchedEntityRefLinks.test.tsx
@@ -23,6 +23,9 @@ import { catalogApiRef } from '../../api';
import { CatalogApi } from '@backstage/catalog-client';
describe('', () => {
+ const getTitle = (e: Entity): string =>
+ (e.spec?.profile!! as JsonObject).displayName!!.toString()!!;
+
it('should fetch entities and render the custom display text', async () => {
const entityRefs = [
{
@@ -57,9 +60,6 @@ describe('', () => {
}),
};
- const getTitle = (e: Entity): string =>
- (e.spec?.profile!! as JsonObject).displayName!!.toString()!!;
-
const rendered = await renderInTestApp(
@@ -81,4 +81,55 @@ describe('', () => {
'/catalog/default/api/interface',
);
});
+
+ it('should use entities as they are provided and render the custom display text', async () => {
+ const entityRefs = [
+ {
+ kind: 'Component',
+ namespace: 'default',
+ name: 'tool',
+ },
+ {
+ kind: 'API',
+ namespace: 'default',
+ name: 'implementation',
+ },
+ ].map(ref => ({
+ apiVersion: 'backstage.io/v1alpha1',
+ kind: ref.kind,
+ metadata: {
+ name: ref.name,
+ namespace: ref.namespace,
+ },
+ spec: {
+ profile: {
+ displayName: ref.name.toLocaleUpperCase('en-US'),
+ },
+ type: 'organization',
+ },
+ }));
+
+ const catalogApi: Partial = {};
+
+ const rendered = await renderInTestApp(
+
+
+ ,
+ {
+ mountedRoutes: {
+ '/catalog/:namespace/:kind/:name/*': entityRouteRef,
+ },
+ },
+ );
+
+ expect(rendered.getByText('TOOL')).toHaveAttribute(
+ 'href',
+ '/catalog/default/component/tool',
+ );
+
+ expect(rendered.getByText('IMPLEMENTATION')).toHaveAttribute(
+ 'href',
+ '/catalog/default/api/implementation',
+ );
+ });
});