Skip to content

Commit

Permalink
chore: updated useAnalytics mocking
Browse files Browse the repository at this point in the history
  • Loading branch information
SagarRajput-7 committed May 1, 2024
1 parent 999d969 commit 0c6d146
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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', () => {
Expand Down

0 comments on commit 0c6d146

Please sign in to comment.