import { describe, expect, it } from 'vitest';
import { locales, defaultLocale } from '../config';
import type { Locale } from '../config';

describe('i18n/config', () => {
  describe('locales', () => {
    it('exports an array of supported locales', () => {
      expect(Array.isArray(locales)).toBe(true);
      expect(locales.length).toBeGreaterThanOrEqual(2);
    });

    it('includes Vietnamese (vi) as a supported locale', () => {
      expect(locales).toContain('vi');
    });

    it('includes English (en) as a supported locale', () => {
      expect(locales).toContain('en');
    });

    it('only contains vi and en', () => {
      expect([...locales]).toEqual(['vi', 'en']);
    });

    it('is a readonly tuple', () => {
      // TypeScript const assertion — runtime check that it behaves as expected
      const copy = [...locales];
      expect(copy).toEqual(['vi', 'en']);
    });
  });

  describe('defaultLocale', () => {
    it('is set to Vietnamese (vi)', () => {
      expect(defaultLocale).toBe('vi');
    });

    it('is one of the supported locales', () => {
      expect(locales).toContain(defaultLocale);
    });
  });

  describe('Locale type', () => {
    it('accepts valid locale values', () => {
      const vi: Locale = 'vi';
      const en: Locale = 'en';
      expect(vi).toBe('vi');
      expect(en).toBe('en');
    });
  });
});
