diff --git a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx index fb1c3adf56..6962d1e18d 100644 --- a/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx +++ b/frontend/__tests__/containers/ReportStep/ReportStep.test.tsx @@ -73,7 +73,7 @@ jest.mock('@src/utils/util', () => ({ let store = null; describe('Report Step', () => { const { result: notificationHook } = renderHook(() => useNotificationLayoutEffect()); - const { result: reportHook } = renderHook(() => useGenerateReportEffect()); + const { result: reportHook } = renderHook(() => useGenerateReportEffect(notificationHook.current)); beforeEach(() => { resetReportHook(); }); diff --git a/frontend/__tests__/hooks/useGenerateReportEffect.test.tsx b/frontend/__tests__/hooks/useGenerateReportEffect.test.tsx index 04db240d82..170451b60d 100644 --- a/frontend/__tests__/hooks/useGenerateReportEffect.test.tsx +++ b/frontend/__tests__/hooks/useGenerateReportEffect.test.tsx @@ -5,6 +5,7 @@ import { TimeoutException } from '@src/exceptions/TimeoutException'; import { UnknownException } from '@src/exceptions/UnknownException'; import { act, renderHook, waitFor } from '@testing-library/react'; import { reportClient } from '@src/clients/report/ReportClient'; +import { MESSAGE } from '@src/constants/resources'; import { HttpStatusCode } from 'axios'; import clearAllMocks = jest.clearAllMocks; import resetAllMocks = jest.resetAllMocks; @@ -42,7 +43,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestBoardData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); @@ -64,7 +65,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestBoardData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); @@ -86,7 +87,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestDoraData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); @@ -120,7 +121,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestDoraData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); @@ -137,7 +138,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestDoraData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); @@ -159,7 +160,7 @@ describe('use generate report effect', () => { .fn() .mockImplementation(async () => ({ response: MOCK_RETRIEVE_REPORT_RESPONSE })); - const { result } = renderHook(() => useGenerateReportEffect()); + const { result } = renderHook(() => useGenerateReportEffect(notificationHook.current)); await waitFor(() => { result.current.startToRequestBoardData(MOCK_GENERATE_REPORT_REQUEST_PARAMS); diff --git a/frontend/src/containers/MetricsStep/index.tsx b/frontend/src/containers/MetricsStep/index.tsx index 07bec419c0..fb24c2a704 100644 --- a/frontend/src/containers/MetricsStep/index.tsx +++ b/frontend/src/containers/MetricsStep/index.tsx @@ -63,6 +63,9 @@ const MetricsStep = ({ closeAllNotifications }: useNotificationLayoutEffectInter useLayoutEffect(() => { closeAllNotifications(); + }, []); + + useLayoutEffect(() => { getInfo(); }, []); diff --git a/frontend/src/hooks/useGenerateReportEffect.ts b/frontend/src/hooks/useGenerateReportEffect.ts index ab8fb034fb..ad4b157bbf 100644 --- a/frontend/src/hooks/useGenerateReportEffect.ts +++ b/frontend/src/hooks/useGenerateReportEffect.ts @@ -1,3 +1,4 @@ +import { useNotificationLayoutEffectInterface } from '@src/hooks/useNotificationLayoutEffect'; import { BoardReportRequestDTO, ReportRequestDTO } from '@src/clients/report/dto/request'; import { exportValidityTimeMapper } from '@src/hooks/reportMapper/exportValidityTime'; import { ReportResponseDTO } from '@src/clients/report/dto/response';