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

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

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