Skip to content

Commit

Permalink
Merge branch 'clean' into feat-Hgn-email-template
Browse files Browse the repository at this point in the history
  • Loading branch information
taiwonaf committed Jul 25, 2024
2 parents df6edde + 9056c3b commit 7e3db9a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
10 changes: 3 additions & 7 deletions src/app/(auth-routes)/register/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -59,10 +59,6 @@ const SignUp = () => {
form.handleSubmit(handleFormSubmit)();
};

useEffect(() => {
console.log("Form Validity:", form.formState.isValid);
}, [form.formState.isValid]);

return (
<div>
<div className="flex flex-col items-center gap-2">
Expand All @@ -79,8 +75,8 @@ const SignUp = () => {
<Form {...form}>
<form
className="space-y-8"
onSubmit={(e) => {
e.preventDefault();
onSubmit={(event) => {
event.preventDefault();
handleSubmit();
}}
>
Expand Down
15 changes: 15 additions & 0 deletions src/test/auth-routes/register.testx.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 7e3db9a

Please sign in to comment.