From b15470b74ce27d739decfb559726de90bc37616d Mon Sep 17 00:00:00 2001 From: 4nalog <88684372+4nalog@users.noreply.github.com> Date: Sat, 4 Mar 2023 02:47:56 +0530 Subject: [PATCH] fix: project settings dashbboard tests (#701) * fix: project settings dashbboard tests Signed-off-by: 4nalog <4nalog@protonmail.com> * chore: remove .only Signed-off-by: 4nalog <4nalog@protonmail.com> * refactor: remove empty waitFor Signed-off-by: 4nalog <4nalog@protonmail.com> --------- Signed-off-by: 4nalog <4nalog@protonmail.com> --- .../Project/test/ProjectDashboard.test.tsx | 25 ++++++++++++------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/packages/console/src/components/Project/test/ProjectDashboard.test.tsx b/packages/console/src/components/Project/test/ProjectDashboard.test.tsx index ecc9c299f..592b104e7 100644 --- a/packages/console/src/components/Project/test/ProjectDashboard.test.tsx +++ b/packages/console/src/components/Project/test/ProjectDashboard.test.tsx @@ -26,6 +26,7 @@ import { } from 'models/Project/api'; import { Admin } from '@flyteorg/flyteidl-types'; import * as LocalCache from 'basics/LocalCache'; +import { LocalCacheProvider } from 'basics/LocalCache/ContextProvider'; import { ProjectDashboard } from '../ProjectDashboard'; import { failedToLoadExecutionsString } from '../constants'; @@ -141,25 +142,31 @@ describe('ProjectDashboard', () => { render( - + + + , ); it('should display domain attributes section when config was provided', async () => { const { getByText } = renderView(); - expect(getProjectAttributes).toHaveBeenCalled(); expect(getProjectDomainAttributes).toHaveBeenCalled(); + await waitFor(() => { + expect(getProjectAttributes).toHaveBeenCalled(); + }); + await waitFor(() => { expect(getByText('Domain Settings')).toBeInTheDocument(); - expect( - getByText('cliOutputLocationPrefixFromProjectAttributes'), - ).toBeInTheDocument(); - expect(getByText('cliAnnotationKey')).toBeInTheDocument(); - expect( - getByText('cliAnnotationValueFromProjectAttributes'), - ).not.toBeInTheDocument(); }); + + expect( + getByText('cliOutputLocationPrefixFromProjectAttributes'), + ).toBeInTheDocument(); + expect(getByText('cliAnnotationKey')).toBeInTheDocument(); }); it('should show loading spinner', async () => {