diff --git a/src/app/(auth-routes)/register/page.tsx b/src/app/(auth-routes)/register/page.tsx index 52de58043..0dd28b00c 100644 --- a/src/app/(auth-routes)/register/page.tsx +++ b/src/app/(auth-routes)/register/page.tsx @@ -3,7 +3,7 @@ import { zodResolver } from "@hookform/resolvers/zod"; import { DialogContent, DialogTitle } from "@radix-ui/react-dialog"; import Link from "next/link"; -import { useEffect, useState } from "react"; +import { useState } from "react"; import { useForm } from "react-hook-form"; import { z } from "zod"; @@ -59,10 +59,6 @@ const SignUp = () => { form.handleSubmit(handleFormSubmit)(); }; - useEffect(() => { - console.log("Form Validity:", form.formState.isValid); - }, [form.formState.isValid]); - return (
@@ -79,8 +75,8 @@ const SignUp = () => {
{ - e.preventDefault(); + onSubmit={(event) => { + event.preventDefault(); handleSubmit(); }} > diff --git a/src/test/auth-routes/register.testx.tsx b/src/test/auth-routes/register.testx.tsx index 075f52b1e..d5b4d717b 100644 --- a/src/test/auth-routes/register.testx.tsx +++ b/src/test/auth-routes/register.testx.tsx @@ -12,12 +12,21 @@ describe("signUp Component", () => { await waitFor(() => { expect(screen.getByText("Sign Up")).toBeInTheDocument(); + }); + + await waitFor(() => { expect( screen.getByPlaceholderText("Enter your fullname"), ).toBeInTheDocument(); + }); + + await waitFor(() => { expect( screen.getByPlaceholderText("Enter your email address"), ).toBeInTheDocument(); + }); + + await waitFor(() => { expect( screen.getByPlaceholderText("Enter your password"), ).toBeInTheDocument(); @@ -45,9 +54,15 @@ describe("signUp Component", () => { expect( screen.getByText("Fullname must be at least 2 characters."), ).toBeInTheDocument(); + }); + + await waitFor(() => { expect( screen.getByText("Email must be at least 2 characters."), ).toBeInTheDocument(); + }); + + await waitFor(() => { expect( screen.getByText("Password must be at least 2 characters."), ).toBeInTheDocument();