From 582dfb5359009e74913b0466976a6ee77a29a822 Mon Sep 17 00:00:00 2001 From: mario ma Date: Tue, 18 Jun 2024 19:54:41 +0800 Subject: [PATCH] fix: EntityNamespacePicker test Signed-off-by: mario ma --- .../EntityNamespacePicker.test.tsx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/plugins/catalog-react/src/components/EntityNamespacePicker/EntityNamespacePicker.test.tsx b/plugins/catalog-react/src/components/EntityNamespacePicker/EntityNamespacePicker.test.tsx index 05fa1dc07f..0fd336da42 100644 --- a/plugins/catalog-react/src/components/EntityNamespacePicker/EntityNamespacePicker.test.tsx +++ b/plugins/catalog-react/src/components/EntityNamespacePicker/EntityNamespacePicker.test.tsx @@ -215,7 +215,7 @@ describe('', () => { }), ); }); - it('namespace picker is invisible if there are only 1 available option', async () => { + it('namespace picker is visible if there are only 1 available option', async () => { const defaultNamespaces = ['default', 'default', 'default']; const mockCatalogApiRefDefaultNamespace = { getEntityFacets: async () => ({ @@ -236,6 +236,27 @@ describe('', () => { , ); + await waitFor(() => + expect(screen.queryByText('Namespace')).toBeInTheDocument(), + ); + }); + it('namespace picker is invisible if there is zero available option', async () => { + const mockCatalogApiRefDefaultNamespace = { + getEntityFacets: async () => ({ + facets: { + 'metadata.namespace': [], + }, + }), + } as unknown as CatalogApi; + await renderInTestApp( + + + + + , + ); await waitFor(() => expect(screen.queryByText('Namespace')).not.toBeInTheDocument(), );