Skip to content

Commit 6b77c3a

Browse files
Gtag func is undefined in tests suits
Fix it so the test can run without it defined
1 parent ee4865a commit 6b77c3a

File tree

2 files changed

+2
-4
lines changed

2 files changed

+2
-4
lines changed

src/Game.test.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import * as React from 'react';
22
import * as ReactDOM from 'react-dom';
33

4-
(global as any).gtag = () => undefined;
5-
64
import Game from './Game';
75

86
(window as any).HTMLElement.prototype.scrollIntoView = () => undefined;

src/scenario/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ function timeDiffInSeconds(): number {
3030
return Math.floor((new Date().getTime() - startTime.getTime()) / 1000);
3131
}
3232

33-
const gtag = (global as any).gtag as any;
33+
const gtag: (a: any, b:any, c:any) => void = (global as any).gtag;
3434
const tagIt = (action: string) =>
35-
gtag('event', action, {
35+
!!gtag && gtag('event', action, {
3636
event_category: 'game',
3737
event_label: new Date().toUTCString(),
3838
value: timeDiffInSeconds(),

0 commit comments

Comments
 (0)