From 84bbcbfb6db2e1216ba8d9cde84ea89bac08313d Mon Sep 17 00:00:00 2001 From: Jarrod Lilkendey Date: Tue, 28 May 2024 17:33:37 +1000 Subject: [PATCH] include test coverage --- __tests__/ui/tests/habits.test.tsx | 14 ++++++++++++++ pages/login/index.tsx | 2 +- pages/user/index.tsx | 10 ++-------- 3 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 __tests__/ui/tests/habits.test.tsx diff --git a/__tests__/ui/tests/habits.test.tsx b/__tests__/ui/tests/habits.test.tsx new file mode 100644 index 0000000..1d0a37e --- /dev/null +++ b/__tests__/ui/tests/habits.test.tsx @@ -0,0 +1,14 @@ +import { render, screen } from '@testing-library/react' +// import { mockTools } from '@/__mocks__/mockData' + +import HabitsPage from '@/pages/habits' + +describe('Time Tracker Page tests', () => { + test('renders a heading', async () => { + render() + + expect( + screen.getByRole('heading', { name: 'Habit Tracker' }) + ).toBeInTheDocument() + }) +}) diff --git a/pages/login/index.tsx b/pages/login/index.tsx index a240ec9..5058ea6 100644 --- a/pages/login/index.tsx +++ b/pages/login/index.tsx @@ -1,7 +1,7 @@ import SignInForm from '@/components/auth/SignInForm' import SignUpForm from '@/components/auth/SignUpForm' -export default function LoginSignUp() { +export default function LoginSignUpPage() { return (
diff --git a/pages/user/index.tsx b/pages/user/index.tsx index fae14cb..98a7079 100644 --- a/pages/user/index.tsx +++ b/pages/user/index.tsx @@ -1,12 +1,6 @@ import { useSession } from 'next-auth/react' -// data strategy: Client-Side Rendering with SWR (within UserReservations component) -// (static pages or ISR doesn't make sense; only one user is using this page! -// no advantage to caching.) -// Why not SSR? no need for SEO either, esp since it's behind auth barrier! -// plus SSR is slow - -export default function UserProfile() { +export default function UserPage() { const { data: session } = useSession() const userId = session?.user?.user?.id @@ -20,4 +14,4 @@ export default function UserProfile() { ) } -UserProfile.auth = true +UserPage.auth = true