Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sayan-mitra committed Jan 12, 2021
1 parent 9dadc82 commit 6635513
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions integrations/GA/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default class GA {
];
}

initializeAndloadScript() {
initializeGlobalObject() {
window.GoogleAnalyticsObject = "ga";
window.ga =
window.ga ||
Expand All @@ -50,6 +50,9 @@ export default class GA {
window.ga.q.push(arguments);
};
window.ga.l = new Date().getTime();
}

loadScript() {
ScriptLoader(
"google-analytics",
"https://www.google-analytics.com/analytics.js"
Expand Down Expand Up @@ -84,7 +87,8 @@ export default class GA {
});

if (this.analytics.loadIntegration) {
this.initializeAndloadScript();
this.initializeGlobalObject();
this.loadScript();
}

// create ga with these properties. if the properties are empty it will take default values.
Expand Down
2 changes: 1 addition & 1 deletion integrations/GA/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ afterAll(() => {
jest.restoreAllMocks();
});

GA.prototype.initializeAndloadScript = jest.fn();
GA.prototype.loadScript = jest.fn();

describe("GA init tests", () => {
let googleAnalytics;
Expand Down

0 comments on commit 6635513

Please sign in to comment.