From 6bd5cade395efce94f06d00047bcee88e77b4140 Mon Sep 17 00:00:00 2001 From: Aramis Sennyey Date: Mon, 13 Feb 2023 13:53:02 -0500 Subject: [PATCH] Add catalog API report and fix test cases. Signed-off-by: Aramis Sennyey --- plugins/catalog-react/api-report.md | 9 +++++++++ .../src/components/EntityRefLink/humanize.ts | 6 ++++-- .../components/CatalogPage/DefaultCatalogPage.test.tsx | 7 +++++++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/plugins/catalog-react/api-report.md b/plugins/catalog-react/api-report.md index 77f439018f..9b318ec116 100644 --- a/plugins/catalog-react/api-report.md +++ b/plugins/catalog-react/api-report.md @@ -453,6 +453,15 @@ export function getEntitySourceLocation( scmIntegrationsApi: ScmIntegrationRegistry, ): EntitySourceLocation | undefined; +// @public +export function humanizeEntity( + entity: Entity, + opts?: { + defaultKind?: string; + defaultNamespace?: string | false; + }, +): string; + // @public (undocumented) export function humanizeEntityRef( entityRef: Entity | CompoundEntityRef, diff --git a/plugins/catalog-react/src/components/EntityRefLink/humanize.ts b/plugins/catalog-react/src/components/EntityRefLink/humanize.ts index 815dac0758..1e377e1859 100644 --- a/plugins/catalog-react/src/components/EntityRefLink/humanize.ts +++ b/plugins/catalog-react/src/components/EntityRefLink/humanize.ts @@ -75,9 +75,11 @@ export function humanizeEntityRef( * * If neither of those are found or populated, fallback to `humanizeEntityRef`. * - * @param entity Entity to convert. - * @param opts If entity readable name is not available, opts will be used to specify humanizeEntityRef options. + * @param entity - Entity to convert. + * @param opts - If entity readable name is not available, opts will be used to specify humanizeEntityRef options. * @returns Readable name, defaults to unique identifier. + * + * @public */ export function humanizeEntity( entity: Entity, diff --git a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx index 7b92df5809..3411656426 100644 --- a/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx +++ b/plugins/catalog/src/components/CatalogPage/DefaultCatalogPage.test.tsx @@ -119,6 +119,13 @@ describe('DefaultCatalogPage', () => { ], }; }, + /** + * For the purposes of this test case, use existing functionality. The picker + * isn't being tested, just needs this method to render correctly. + */ + getEntitiesByRefs: async refs => { + return { items: refs.entityRefs.map(() => undefined) }; + }, }; const testProfile: Partial = { displayName: 'Display Name',