mirror of
https://github.com/techno-tim/littlelink-server.git
synced 2025-01-21 14:51:22 +01:00
chore(tests): cleaned up
This commit is contained in:
parent
99cf1bc7de
commit
189fee14cb
@ -1,6 +1,6 @@
|
|||||||
import { trackGoogleEvent } from './google';
|
import { trackGoogleEvent } from './google';
|
||||||
|
|
||||||
it('should call gtag with event', () => {
|
describe('google.js', () => {
|
||||||
const mockedGtag = jest.fn();
|
const mockedGtag = jest.fn();
|
||||||
const originalWindow = { ...window };
|
const originalWindow = { ...window };
|
||||||
const windowSpy = jest.spyOn(global, 'window', 'get');
|
const windowSpy = jest.spyOn(global, 'window', 'get');
|
||||||
@ -8,9 +8,9 @@ it('should call gtag with event', () => {
|
|||||||
...originalWindow,
|
...originalWindow,
|
||||||
gtag: mockedGtag,
|
gtag: mockedGtag,
|
||||||
}));
|
}));
|
||||||
|
it('should call gtag with event', () => {
|
||||||
trackGoogleEvent('youtube-button');
|
trackGoogleEvent('youtube-button');
|
||||||
expect(mockedGtag).toBeCalledWith('event', 'youtube-button');
|
expect(mockedGtag).toBeCalledWith('event', 'youtube-button');
|
||||||
|
windowSpy.mockRestore();
|
||||||
windowSpy.mockRestore();
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,16 +1,16 @@
|
|||||||
import { trackUmamiEvent } from './umami';
|
import { trackUmamiEvent } from './umami';
|
||||||
|
|
||||||
it('should call gtag with event', () => {
|
describe('umami.js', () => {
|
||||||
|
const windowSpy = jest.spyOn(global, 'window', 'get');
|
||||||
const mockedUmami = jest.fn();
|
const mockedUmami = jest.fn();
|
||||||
const originalWindow = { ...window };
|
const originalWindow = { ...window };
|
||||||
const windowSpy = jest.spyOn(global, 'window', 'get');
|
|
||||||
windowSpy.mockImplementation(() => ({
|
windowSpy.mockImplementation(() => ({
|
||||||
...originalWindow,
|
...originalWindow,
|
||||||
umami: mockedUmami,
|
umami: mockedUmami,
|
||||||
}));
|
}));
|
||||||
|
it('should call umami with event', () => {
|
||||||
trackUmamiEvent('youtube-button');
|
trackUmamiEvent('youtube-button');
|
||||||
expect(mockedUmami).toBeCalledWith('youtube-button');
|
expect(mockedUmami).toBeCalledWith('youtube-button');
|
||||||
|
windowSpy.mockRestore();
|
||||||
windowSpy.mockRestore();
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user