diff options
author | stanislavh <stanislav.honcharov@sonarsource.com> | 2024-02-22 12:03:03 +0100 |
---|---|---|
committer | sonartech <sonartech@sonarsource.com> | 2024-02-23 20:02:36 +0000 |
commit | bf71383a30f8c44e3b2e703c08f76431b1eace1e (patch) | |
tree | 561783f448354cbdc14f02b53a0635a965e8f3e5 /server/sonar-web/src/main/js | |
parent | 81e54cbf0f288a2d4f9a4e398abf2883e15473e8 (diff) | |
download | sonarqube-bf71383a30f8c44e3b2e703c08f76431b1eace1e.tar.gz sonarqube-bf71383a30f8c44e3b2e703c08f76431b1eace1e.zip |
SONAR-21692 Remove warnings from indexation components
Diffstat (limited to 'server/sonar-web/src/main/js')
2 files changed, 7 insertions, 6 deletions
diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx index 704d0d4375b..c78d6ffddc1 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationContextProvider-test.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { waitFor } from '@testing-library/react'; import * as React from 'react'; import { useContext } from 'react'; import { mockAppState } from '../../../../helpers/testMocks'; @@ -60,11 +61,10 @@ it('should update the state on new status', async () => { expect(byText('null').get()).toBeInTheDocument(); - triggerNewStatus(newStatus); - - expect( - await byText('{"status":{"hasFailures":false,"isCompleted":true}}').find(), - ).toBeInTheDocument(); + await waitFor(() => { + triggerNewStatus(newStatus); + }); + expect(byText('{"status":{"hasFailures":false,"isCompleted":true}}').get()).toBeInTheDocument(); }); function renderIndexationContextProvider(props?: IndexationContextProviderProps) { diff --git a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx index d387a7e3554..ce3683330c1 100644 --- a/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx +++ b/server/sonar-web/src/main/js/app/components/indexation/__tests__/IndexationNotification-test.tsx @@ -17,6 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +import { act } from '@testing-library/react'; import * as React from 'react'; import { mockCurrentUser, mockLoggedInUser } from '../../../../helpers/testMocks'; import { renderComponent } from '../../../../helpers/testReactTestingUtils'; @@ -78,7 +79,7 @@ describe('Completed banner', () => { expect(IndexationNotificationHelper.markCompletedNotificationAsDisplayed).toHaveBeenCalled(); - jest.runAllTimers(); + act(() => jest.runOnlyPendingTimers()); expect(IndexationNotificationHelper.markCompletedNotificationAsDisplayed).toHaveBeenCalled(); |