import { describe, expect, it } from 'vitest'
import { isStorefrontLanguage } from './i18n'

describe('storefront language guard', () => {
  it('accepts the supported storefront locales', () => {
    expect(isStorefrontLanguage('en')).toBe(true)
    expect(isStorefrontLanguage('fr')).toBe(true)
    expect(isStorefrontLanguage('ar')).toBe(true)
  })

  it('rejects unsupported, missing, and case-mismatched locales', () => {
    expect(isStorefrontLanguage('de')).toBe(false)
    expect(isStorefrontLanguage('EN')).toBe(false)
    expect(isStorefrontLanguage('')).toBe(false)
    expect(isStorefrontLanguage(null)).toBe(false)
    expect(isStorefrontLanguage(undefined)).toBe(false)
  })
})
