mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
19be14b72f
Co-authored-by: Oliver Eyton-Williams <ojeytonwilliams@gmail.com>
25 lines
626 B
TypeScript
25 lines
626 B
TypeScript
import callGA, { GAevent } from './call-ga';
|
|
import TagManager from '.';
|
|
|
|
jest.mock('.', () => ({
|
|
dataLayer: jest.fn()
|
|
}));
|
|
|
|
describe('callGA function', () => {
|
|
it('calls TagManager dataLayer with the same arguments', () => {
|
|
const eventDataMock: GAevent = {
|
|
event: 'donation',
|
|
action: 'Donate Page Stripe Payment Submission',
|
|
duration: 'month',
|
|
amount: 500,
|
|
completed_challenges: 100,
|
|
completed_challenges_session: 10,
|
|
isSignedIn: true
|
|
};
|
|
callGA(eventDataMock);
|
|
expect(TagManager.dataLayer).toHaveBeenCalledWith({
|
|
dataLayer: eventDataMock
|
|
});
|
|
});
|
|
});
|