mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 08:31:23 -05:00
test: fix join flow analytics test for GTM/GA4
This commit is contained in:
parent
60c81e5435
commit
f6953b7185
1 changed files with 6 additions and 8 deletions
|
@ -67,17 +67,15 @@ describe('JoinFlow', () => {
|
|||
});
|
||||
});
|
||||
|
||||
test('sendAnalytics calls google analytics with correct params', () => {
|
||||
test('sendAnalytics calls GTM with correct params', () => {
|
||||
const joinFlowInstance = getJoinFlowWrapper().instance();
|
||||
global.window.ga = jest.fn();
|
||||
global.window.dataLayer = {push: jest.fn()};
|
||||
global.window.GA_ID = '1234';
|
||||
joinFlowInstance.sendAnalytics('page-path');
|
||||
const obj = {
|
||||
hitType: 'pageview',
|
||||
page: 'page-path',
|
||||
tid: '1234'
|
||||
};
|
||||
expect(global.window.ga).toHaveBeenCalledWith('send', obj);
|
||||
expect(global.window.dataLayer.push).toHaveBeenCalledWith({
|
||||
event: 'join_flow',
|
||||
joinFlowStep: 'page-path'
|
||||
});
|
||||
});
|
||||
|
||||
test('handleAdvanceStep', () => {
|
||||
|
|
Loading…
Reference in a new issue