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,31 +0,0 @@
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { renderHook } from '@testing-library/react';
|
||||
|
||||
import { useIsTasksPage } from '../useIsTasksPage';
|
||||
|
||||
const getWrapper =
|
||||
(initialIndex: 0 | 1) =>
|
||||
({ children }: { children: React.ReactNode }) => (
|
||||
<MemoryRouter
|
||||
initialEntries={['/settings/', '/tasks']}
|
||||
initialIndex={initialIndex}
|
||||
>
|
||||
{children}
|
||||
</MemoryRouter>
|
||||
);
|
||||
|
||||
describe('useIsSettingsPage', () => {
|
||||
it('should return true for pages which has /tasks in pathname', () => {
|
||||
const { result } = renderHook(() => useIsTasksPage(), {
|
||||
wrapper: getWrapper(1),
|
||||
});
|
||||
expect(result.current).toBe(true);
|
||||
});
|
||||
|
||||
it('should return false for other pages which does not have /tasks in pathname', () => {
|
||||
const { result } = renderHook(() => useIsTasksPage(), {
|
||||
wrapper: getWrapper(0),
|
||||
});
|
||||
expect(result.current).toBe(false);
|
||||
});
|
||||
});
|
||||
@ -1,3 +0,0 @@
|
||||
import { useLocation } from 'react-router-dom';
|
||||
|
||||
export const useIsTasksPage = () => useLocation().pathname === '/tasks';
|
||||
Reference in New Issue
Block a user