Remove some dead code (#6611)
We could remove a lot more than this, this is just a start. There are various tools to help with this, knip is a good one
This commit is contained in:
@ -1,25 +0,0 @@
|
||||
import { expect } from '@storybook/test';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
import { RecoilRoot } from 'recoil';
|
||||
|
||||
import { useTrackEvent } from '../useTrackEvent';
|
||||
|
||||
const mockTrackMutation = jest.fn();
|
||||
|
||||
jest.mock('~/generated/graphql', () => ({
|
||||
useTrackMutation: () => [mockTrackMutation],
|
||||
}));
|
||||
|
||||
describe('useTrackEvent', () => {
|
||||
it('should call useEventTracker with the correct arguments', async () => {
|
||||
const eventType = 'exampleType';
|
||||
const eventData = { location: { pathname: '/examplePath' } };
|
||||
renderHook(() => useTrackEvent(eventType, eventData), {
|
||||
wrapper: RecoilRoot,
|
||||
});
|
||||
expect(mockTrackMutation).toHaveBeenCalledTimes(1);
|
||||
expect(mockTrackMutation).toHaveBeenCalledWith({
|
||||
variables: { type: eventType, data: eventData },
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -1,7 +0,0 @@
|
||||
import { EventData, useEventTracker } from './useEventTracker';
|
||||
|
||||
export const useTrackEvent = (eventType: string, eventData: EventData) => {
|
||||
const eventTracker = useEventTracker();
|
||||
|
||||
return eventTracker(eventType, eventData);
|
||||
};
|
||||
Reference in New Issue
Block a user