Skip to content

Commit

Permalink
ML: Add useTracking mocks in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gu-stav committed Jul 27, 2022
1 parent 39eb8ab commit 887e7b8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
Expand Up @@ -12,6 +12,11 @@ import SearchAsset from '../index';

const handleChange = jest.fn();

jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'),
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
}));

const makeApp = queryValue => (
<ThemeProvider theme={lightTheme}>
<IntlProvider locale="en">
Expand Down
Expand Up @@ -6,6 +6,11 @@ import { MemoryRouter } from 'react-router-dom';

import { BrowseStep } from '..';

jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'),
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
}));

const FIXTURE_ASSETS = [
{
id: 77,
Expand Down
Expand Up @@ -19,6 +19,7 @@ jest.mock('../../../utils/axiosInstance', () => ({
jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'),
useQueryParams: jest.fn().mockReturnValue([{ query: {} }]),
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
}));

jest.mock('../../../hooks/useMediaLibraryPermissions');
Expand Down
Expand Up @@ -7,6 +7,11 @@ import { PendingAssetStep } from '../PendingAssetStep';

jest.mock('../../../../utils/getTrad', () => x => x);

jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'),
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
}));

const queryClient = new QueryClient({
defaultOptions: {
queries: {
Expand Down
Expand Up @@ -2,6 +2,11 @@ import { renderHook, act } from '@testing-library/react-hooks';

import useModalQueryParams from '../useModalQueryParams';

jest.mock('@strapi/helper-plugin', () => ({
...jest.requireActual('@strapi/helper-plugin'),
useTracking: jest.fn(() => ({ trackUsage: jest.fn() })),
}));

const FIXTURE_QUERY = {
page: 1,
sort: 'updatedAt:DESC',
Expand Down

0 comments on commit 887e7b8

Please sign in to comment.