/**
 * (routing object aligns with locale constants; defineRouting passthrough).
 */
import { LOCALES_DEFAULT, LOCALES_LIST } from '@/constants/locales'

jest.mock('next-intl/routing', () => ({
  defineRouting: (opts: {
    locales: string[]
    defaultLocale: string
    localePrefix: string
  }) => opts,
}))

import { routing } from '../routing'

describe('[i18n/routing]', () => {
  describe('locale constants consistency', () => {
    it('LOCALES_LIST is non-empty and includes vi', () => {
      expect(LOCALES_LIST.length).toBeGreaterThanOrEqual(1)
      expect(LOCALES_LIST).toContain('vi')
    })

    it('LOCALES_DEFAULT is vi and present in LOCALES_LIST', () => {
      expect(LOCALES_DEFAULT).toBe('vi')
      expect(LOCALES_LIST).toContain(LOCALES_DEFAULT)
    })
  })

  describe('routing export', () => {
    it('mirrors locale list, default and always prefix', () => {
      expect(routing.locales).toEqual(LOCALES_LIST)
      expect(routing.defaultLocale).toBe(LOCALES_DEFAULT)
      expect(routing.localePrefix).toBe('always')
    })
  })
})
