import { describe, expect, it } from 'vitest'; import { languageDetection } from '@/i18n/config'; describe('languageDetection', () => { it('without a default language keeps the old order: stored choice, then browser, fallback English', () => { expect(languageDetection(undefined)).toEqual({ order: ['localStorage', 'navigator'], fallbackLng: 'en' }); }); it('with a default language: stored choice first, then that default, and the browser is not consulted', () => { expect(languageDetection('nl')).toEqual({ order: ['localStorage'], fallbackLng: 'nl' }); expect(languageDetection('en')).toEqual({ order: ['localStorage'], fallbackLng: 'en' }); }); });