Skip to content

Commit

Permalink
Gtag func is undefined in tests suits
Browse files Browse the repository at this point in the history
Fix it so the test can run without it defined
  • Loading branch information
alexander-svendsen committed Jan 9, 2019
1 parent ee4865a commit 6b77c3a
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/Game.test.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import * as React from 'react';
import * as ReactDOM from 'react-dom';

(global as any).gtag = () => undefined;

import Game from './Game';

(window as any).HTMLElement.prototype.scrollIntoView = () => undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/scenario/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ function timeDiffInSeconds(): number {
return Math.floor((new Date().getTime() - startTime.getTime()) / 1000);
}

const gtag = (global as any).gtag as any;
const gtag: (a: any, b:any, c:any) => void = (global as any).gtag;
const tagIt = (action: string) =>
gtag('event', action, {
!!gtag && gtag('event', action, {
event_category: 'game',
event_label: new Date().toUTCString(),
value: timeDiffInSeconds(),
Expand Down

0 comments on commit 6b77c3a

Please sign in to comment.