1
0
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:
Matthias Kretschmann 2019-05-16 15:07:28 +02:00 committed by GitHub
commit 51a97bd968
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 5 deletions

View File

@ -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

View File

@ -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} />)