import {
  describe,
  expect,
  it
} from 'vitest';

import {
  DEFAULT_APP_LOCALE,
  SUPPORTED_APP_LOCALES,
  resolveAppLocale
} from './app-i18n.rules';

describe('app-i18n.rules', () => {
  it('ships only English as the default locale', () => {
    expect(DEFAULT_APP_LOCALE).toBe('en');
    expect(SUPPORTED_APP_LOCALES).toEqual(['en']);
  });

  it('resolves unknown locale candidates to the default locale', () => {
    expect(resolveAppLocale(null)).toBe('en');
    expect(resolveAppLocale(undefined)).toBe('en');
    expect(resolveAppLocale('')).toBe('en');
    expect(resolveAppLocale('fr')).toBe('en');
  });

  it('accepts supported locale candidates', () => {
    expect(resolveAppLocale('en')).toBe('en');
  });
});
