0
Hello I have the following context:
import React from 'react'
const AuthContext = React.createContext({
isAuth: false,
login: f => f,
logoff: f => f
})
const AuthProvider = ({ children }) => {
const [isAuth, setIsAuth] = React.useState(false)
const login = () => setIsAuth(true)
const logoff = () => setIsAuth(false)
return (
<AuthContext.Provider value={{ isAuth, login, logoff }}>
{children}
</AuthContext.Provider>
)
}
const useAuthContext = React.useContext(AuthContext)
I need to create a test where the user is already logged in, that is, the isAuth property must be set to true
. What I need to do to change this property within a jest test?