diff --git a/client/src/hoc/withTracker.tsx b/client/src/hoc/withTracker.tsx index f5a74b2..272b8dc 100644 --- a/client/src/hoc/withTracker.tsx +++ b/client/src/hoc/withTracker.tsx @@ -3,15 +3,15 @@ import ReactGA, { FieldsObject } from 'react-ga' import { RouteComponentProps } from 'react-router-dom' import { analyticsId } from '../config' +ReactGA.initialize(analyticsId, { + testMode: process.env.NODE_ENV === 'test', + debug: false +}) + const withTracker =

( WrappedComponent: any, options: FieldsObject = {} ) => { - ReactGA.initialize(analyticsId, { - testMode: process.env.NODE_ENV === 'test', - debug: false - }) - const trackPage = (page: string) => { options.isWeb3 = window.web3 !== undefined diff --git a/client/src/routes/Details/AssetFile.test.tsx b/client/src/routes/Details/AssetFile.test.tsx index 2b866d6..5b135b7 100644 --- a/client/src/routes/Details/AssetFile.test.tsx +++ b/client/src/routes/Details/AssetFile.test.tsx @@ -4,6 +4,7 @@ import React from 'react' import { render, fireEvent } from 'react-testing-library' import { DDO } from '@oceanprotocol/squid' import { StateMock } from '@react-mock/state' +import ReactGA from 'react-ga' import { User } from '../../context' import AssetFile from './AssetFile' @@ -31,6 +32,8 @@ const contextConnectedMock = { message: '' } +ReactGA.initialize('foo', { testMode: true }) + describe('AssetFile', () => { it('renders without crashing', () => { const { container } = render()