mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
Merge pull request #129 from oceanprotocol/fix/react-ga
fix react-ga initialization
This commit is contained in:
commit
51a97bd968
@ -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 = <P extends RouteComponentProps>(
|
||||
WrappedComponent: any,
|
||||
options: FieldsObject = {}
|
||||
) => {
|
||||
ReactGA.initialize(analyticsId, {
|
||||
testMode: process.env.NODE_ENV === 'test',
|
||||
debug: false
|
||||
})
|
||||
|
||||
const trackPage = (page: string) => {
|
||||
options.isWeb3 = window.web3 !== undefined
|
||||
|
||||
|
@ -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(<AssetFile file={file} ddo={ddo} />)
|
||||
|
Loading…
Reference in New Issue
Block a user