import { describe, it, expect, beforeEach } from 'vitest'
import { setActivePinia, createPinia } from 'pinia'
import { useUiStore } from '../ui.store'

describe('useUiStore', () => {
  beforeEach(() => {
    setActivePinia(createPinia())
    document.cookie.split(';').forEach(c => {
      document.cookie = c.replace(/^ +/, '').replace(/=.*/, '=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/')
    })
  })

  it('starts with retro mode off by default', () => {
    const store = useUiStore()
    expect(store.isRetroMode).toBe(false)
  })

  it('toggles retro mode', () => {
    const store = useUiStore()
    store.toggleRetroMode()
    expect(store.isRetroMode).toBe(true)
    store.toggleRetroMode()
    expect(store.isRetroMode).toBe(false)
  })

  it('toggles menu', () => {
    const store = useUiStore()
    expect(store.menuOpen).toBe(false)
    store.toggleMenu()
    expect(store.menuOpen).toBe(true)
  })

  it('closes menu', () => {
    const store = useUiStore()
    store.toggleMenu()
    store.closeMenu()
    expect(store.menuOpen).toBe(false)
  })
})
