From 0c6d1460b84496fa36914e42517ec3b9350e4f4a Mon Sep 17 00:00:00 2001 From: Sagar Rajput Date: Tue, 30 Apr 2024 04:21:31 +0530 Subject: [PATCH] chore: updated useAnalytics mocking --- .../PipelinePage/tests/CreatePipelineButton.test.tsx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/frontend/src/container/PipelinePage/tests/CreatePipelineButton.test.tsx b/frontend/src/container/PipelinePage/tests/CreatePipelineButton.test.tsx index 1e29d1dcc59..49d0a132eaa 100644 --- a/frontend/src/container/PipelinePage/tests/CreatePipelineButton.test.tsx +++ b/frontend/src/container/PipelinePage/tests/CreatePipelineButton.test.tsx @@ -1,6 +1,5 @@ import { render } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; -import * as useAnalytics from 'hooks/analytics/useAnalytics'; import { I18nextProvider } from 'react-i18next'; import { Provider } from 'react-redux'; import { MemoryRouter } from 'react-router-dom'; @@ -11,9 +10,12 @@ import CreatePipelineButton from '../Layouts/Pipeline/CreatePipelineButton'; import { pipelineApiResponseMockData } from '../mocks/pipeline'; const trackEventVar = jest.fn(); -jest.spyOn(useAnalytics, 'default').mockImplementation(() => ({ - trackEvent: trackEventVar, - trackPageView: jest.fn(), +jest.mock('hooks/analytics/useAnalytics', () => ({ + __esModule: true, + default: jest.fn().mockImplementation(() => ({ + trackEvent: trackEventVar, + trackPageView: jest.fn(), + })), })); describe('PipelinePage container test', () => {