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