I'm trying to set a cookie in my test to make sure it's getting cleared out in my component:
import Cookies from 'universal-cookie';
test('successfully logs the user out', async () => {
const cookie = new Cookies()
cookie.set('authtoken', 'some-token')
const { getByText } = render(<Logout/>)
})
But in my Logout component the cookies object is empty:
export default function Logout() {
const [cookies, setCookie, removeCookie] = useCookies(['authtoken'])
console.log(cookies)
}
Is there another way to do this? Preferably one that isn't passing the cookie as a prop.
By adding