NuxtN
Nuxt13mo ago
Yuri

Vitest and useCookie

const layoutBannerTopIsHidden = useCookie<boolean>(CookieLayoutBannerTopIsHidden, { maxAge: 60 * 60 * 24 * 7, default: () => false })

if (layoutBannerTopIsHidden.value) {
  closeInStore()
}


How I can mock cookie set ? I want to check two scenarios:
  1. CookieLayoutBannerTopIsHidden is TRUE and banner is not showing
  2. CookieLayoutBannerTopIsHidden is FALSE and banner not showing
Was this page helpful?