From 04bcdbddfb168cf2e7917c626473585627b5c533 Mon Sep 17 00:00:00 2001 From: Vincenzo Scamporlino Date: Tue, 26 Nov 2024 16:37:59 +0100 Subject: [PATCH] catalog-react: fix tests Signed-off-by: Vincenzo Scamporlino --- .../EntityOwnerPicker.test.tsx | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx index 9d9c25a233..7591d4c3ae 100644 --- a/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityOwnerPicker/EntityOwnerPicker.test.tsx @@ -402,17 +402,16 @@ describe('', () => { fireEvent.click(screen.getByTestId('owner-picker-expand')); + // // some-owner, some-owner-2, another-owner, another-owner-2 await waitFor(() => - expect(screen.getByText('Another Owner')).toBeInTheDocument(), + expect(screen.getByText('some-owner')).toBeInTheDocument(), ); - [ - 'some-owner', - 'Some Owner 2', - 'Another Owner in Another Namespace', - ].forEach(owner => { - expect(screen.getByText(owner)).toBeInTheDocument(); - }); + ['some-owner-2', 'another-owner', 'test-namespace/another-owner-2'].forEach( + owner => { + expect(screen.getByText(owner)).toBeInTheDocument(); + }, + ); expect(mockCatalogApi.getEntityFacets).toHaveBeenCalledTimes(1); @@ -423,9 +422,9 @@ describe('', () => { ); [ - 'some-owner-batch-2', - 'Some Owner Batch 2', - 'Another Owner in Another Namespace Batch 2', + 'some-owner-2-batch-2', + 'another-owner-batch-2', + 'test-namespace/another-owner-2-batch-2', ].forEach(owner => { expect(screen.getByText(owner)).toBeInTheDocument(); }); @@ -465,10 +464,8 @@ describe('', () => { , ); - expect(mockCatalogApi.getEntitiesByRefs).toHaveBeenCalledWith({ - entityRefs: [...ownerEntitiesBatch1, ...ownerEntitiesBatch2].map(entity => - stringifyEntityRef(entity), - ), + expect(mockCatalogApi.getEntityFacets).toHaveBeenCalledWith({ + facets: ['relations.ownedBy'], }); expect(updateFilters).toHaveBeenLastCalledWith({ owners: undefined,