mirror of
https://github.com/oceanprotocol/commons.git
synced 2023-03-15 18:03:00 +01:00
fix react-ga initialization
This commit is contained in:
parent
d49cace56a
commit
7d64ec2d55
@ -3,15 +3,15 @@ import ReactGA, { FieldsObject } from 'react-ga'
|
|||||||
import { RouteComponentProps } from 'react-router-dom'
|
import { RouteComponentProps } from 'react-router-dom'
|
||||||
import { analyticsId } from '../config'
|
import { analyticsId } from '../config'
|
||||||
|
|
||||||
const withTracker = <P extends RouteComponentProps>(
|
|
||||||
WrappedComponent: any,
|
|
||||||
options: FieldsObject = {}
|
|
||||||
) => {
|
|
||||||
ReactGA.initialize(analyticsId, {
|
ReactGA.initialize(analyticsId, {
|
||||||
testMode: process.env.NODE_ENV === 'test',
|
testMode: process.env.NODE_ENV === 'test',
|
||||||
debug: false
|
debug: false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
const withTracker = <P extends RouteComponentProps>(
|
||||||
|
WrappedComponent: any,
|
||||||
|
options: FieldsObject = {}
|
||||||
|
) => {
|
||||||
const trackPage = (page: string) => {
|
const trackPage = (page: string) => {
|
||||||
options.isWeb3 = window.web3 !== undefined
|
options.isWeb3 = window.web3 !== undefined
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@ import React from 'react'
|
|||||||
import { render, fireEvent } from 'react-testing-library'
|
import { render, fireEvent } from 'react-testing-library'
|
||||||
import { DDO } from '@oceanprotocol/squid'
|
import { DDO } from '@oceanprotocol/squid'
|
||||||
import { StateMock } from '@react-mock/state'
|
import { StateMock } from '@react-mock/state'
|
||||||
|
import ReactGA from 'react-ga'
|
||||||
import { User } from '../../context'
|
import { User } from '../../context'
|
||||||
import AssetFile from './AssetFile'
|
import AssetFile from './AssetFile'
|
||||||
|
|
||||||
@ -31,6 +32,8 @@ const contextConnectedMock = {
|
|||||||
message: ''
|
message: ''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ReactGA.initialize('foo', { testMode: true })
|
||||||
|
|
||||||
describe('AssetFile', () => {
|
describe('AssetFile', () => {
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
const { container } = render(<AssetFile file={file} ddo={ddo} />)
|
const { container } = render(<AssetFile file={file} ddo={ddo} />)
|
||||||
|
Loading…
Reference in New Issue
Block a user