import { describe, expect, it } from 'vitest'
import { getFooterContent, localeOptions } from './StorefrontShell'

describe('StorefrontShell footer content registry', () => {
  it('exposes exactly the supported storefront locales in selector order', () => {
    expect(localeOptions.map((option) => option.value)).toEqual(['en', 'ar', 'fr'])
    expect(localeOptions.every((option) => option.label.length > 0 && option.flag.length > 0)).toBe(true)
  })

  it('returns English footer links with app privacy pointing at the English mobile policy', () => {
    const content = getFooterContent('en')

    expect(content.localeLabel).toBe('Global (English)')
    expect(content.rightsLabel).toBe('All rights reserved.')
    expect(content.primary).toContainEqual({ label: 'Privacy Policy', href: '/app-privacy-en' })
    expect(content.secondary).toContainEqual({ label: 'Contact Sales', href: '/footer/contact-sales' })
  })

  it('returns French labels while preserving canonical footer slugs', () => {
    const content = getFooterContent('fr')

    expect(content.localeLabel).toBe('Europe (French)')
    expect(content.primary).toContainEqual({ label: "Conditions d'utilisation", href: '/footer/terms-of-service' })
    expect(content.secondary).toContainEqual({ label: 'Conditions générales', href: '/footer/general-conditions' })
  })

  it('returns Arabic labels and app privacy href without falling back to English copy', () => {
    const content = getFooterContent('ar')

    expect(content.localeLabel).toBe('North Africa (Arabic)')
    expect(content.rightsLabel).toBe('جميع الحقوق محفوظة.')
    expect(content.primary).toContainEqual({ label: 'سياسة الخصوصية', href: '/app-privacy-ar' })
    expect(content.primary.map((item) => item.label)).not.toContain('Privacy Policy')
  })
})
