From 8bdd346f9f3d46e8ae1b789ddd236a2f82356a71 Mon Sep 17 00:00:00 2001
From: = <=>
Date: Wed, 9 Aug 2023 12:33:15 +0100
Subject: [PATCH] test problems
---
__tests__/auth/register.test.jsx | 54 ++++++++++++++++++++++++-
app/layout.js | 1 +
components/auth/LoginForm.jsx | 8 +++-
components/auth/resetPortal.js | 6 ++-
components/auth/signUpForm.jsx | 22 ++++++----
components/header/header.jsx | 6 +--
components/header/settingsHamburger.jsx | 2 +-
contexts/books.jsx | 3 +-
styles/globals.css | 16 ++++----
styles/header.css | 2 +-
10 files changed, 91 insertions(+), 29 deletions(-)
diff --git a/__tests__/auth/register.test.jsx b/__tests__/auth/register.test.jsx
index 2e2e4cd..62f3ab9 100644
--- a/__tests__/auth/register.test.jsx
+++ b/__tests__/auth/register.test.jsx
@@ -1,7 +1,57 @@
-
+import { screen,render, getByRole, getByText,waitFor, act } from "@testing-library/react"
+import userEvent from '@testing-library/user-event';
+import ReactThemeProvider from "@/components/theme/themeReact/reactThemeProvider"
+import IsAUserLoggedInProvider from "@/contexts/authContext"
+import FireBooksProvider from "@/contexts/fireBooks"
+import NotificationProvider from "@/contexts/notificationContext"
+import DataProvider from "@/contexts/dataContext"
+import BookProvider from "@/contexts/books"
+import ThemeLayout from "@/components/theme/themeReact/themelayout"
+import Header from "@/components/header/header"
+import Footer from "@/components/footer/footer"
+import LoginPage from "@/app/login/page";
+import RootLayout from "@/app/layout";
+import SignUpPage from "@/app/signup/page";
describe('resgister a user tests',()=>{
describe('rendering tests',()=>{
- it('should have')
+ it('should enter correct info',async ()=>{
+
+ let component = null
+ await act(async()=>{
+ component = render(
+
+
+
+
+
+
+
+
+ {/* */}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ })
+ const LoginLink = component.getByText(/login/i)
+ expect(LoginLink).toBeInTheDocument()
+ // await userEvent.type(screen.getByLabelText(/email/i),"abc@gmail.com")
+ // expect(screen.getByText(/abc/i)).toBeInTheDocument()
+
+
+
+ })
})
})
\ No newline at end of file
diff --git a/app/layout.js b/app/layout.js
index 413b3b8..feb11f7 100644
--- a/app/layout.js
+++ b/app/layout.js
@@ -29,6 +29,7 @@ export default function RootLayout({ children }) {
return (
+
{/* */}
diff --git a/components/auth/LoginForm.jsx b/components/auth/LoginForm.jsx
index 5c16d17..747dc2c 100644
--- a/components/auth/LoginForm.jsx
+++ b/components/auth/LoginForm.jsx
@@ -119,10 +119,14 @@ const LoginForm = () => {
diff --git a/components/auth/resetPortal.js b/components/auth/resetPortal.js
index c96223e..e187849 100644
--- a/components/auth/resetPortal.js
+++ b/components/auth/resetPortal.js
@@ -2,12 +2,13 @@
import { IsAUserLoggedInContext } from '@/contexts/authContext'
import { resetPassword } from '@/firebase/auth/reset'
import { useRouter } from 'next/navigation'
-import React, { useContext, useState } from 'react'
+import React, { useContext, useEffect, useState } from 'react'
import ReactDom from 'react-dom'
const ResetPortal = () => {
const {setOpenModal,setNotification}=useContext(IsAUserLoggedInContext)
-
+
const [email,setEmail]=useState("")
+ useEffect(()=>setDomReady(true),[])
const handleBack = ()=>{
setOpenModal((prev)=>false)
//window.navigator
@@ -39,6 +40,7 @@ const ResetPortal = () => {
,
document.getElementById('portal')
)
+
}
export default ResetPortal
\ No newline at end of file
diff --git a/components/auth/signUpForm.jsx b/components/auth/signUpForm.jsx
index aee506f..ab6f892 100644
--- a/components/auth/signUpForm.jsx
+++ b/components/auth/signUpForm.jsx
@@ -19,7 +19,7 @@ const SignUpForm = () => {
const [email,setEmail]=useState()
const [password,setPassword]=useState()
const [confirmPassword,setConfirmPassword]=useState()
- const router = useRouter()
+
const {notification,setNotification,setOpenNotification,openNotification}=useContext(IsAUserLoggedInContext)
const handleSubmit = async(e)=>{
e.preventDefault()
@@ -47,7 +47,7 @@ const SignUpForm = () => {
console.log(err,"err")
}
- router.push("/")
+ window.location.assign("/")
return
}
}
@@ -87,7 +87,7 @@ const SignUpForm = () => {
- router.push("/")
+ window.location.assign("/")
}
}
@@ -106,7 +106,7 @@ const SignUpForm = () => {
console.log(err,"err")
}
- router.push("/")
+ window.location.assign("/")
}
}
@@ -125,7 +125,7 @@ const SignUpForm = () => {
console.log(err,"err")
}
- router.push("/")
+ window.location.assign("/")
}
}
@@ -135,13 +135,19 @@ const SignUpForm = () => {
diff --git a/components/header/header.jsx b/components/header/header.jsx
index c9ba3a8..3b4b779 100644
--- a/components/header/header.jsx
+++ b/components/header/header.jsx
@@ -29,7 +29,7 @@ const Header = () => {
setIsSearch(false)
setIsSettings(false)
if (isStrong && strongText!==null){
- console.log(strongText,isStrong)
+ //console.log(strongText,isStrong)
setIsNote(true)
setIsStrong((prev)=>true)
const myElem = document.querySelector(".note-dict")
@@ -40,7 +40,7 @@ const Header = () => {
}
}
- console.log(isNote,isStrong,"handleMEnu",strongText)
+ //console.log(isNote,isStrong,"handleMEnu",strongText)
}
@@ -77,7 +77,7 @@ const Header = () => {