22976abe92
- React 18 + Vite + TypeScript + Tailwind CSS setup - AppShell with Sidebar (plugin menu) + TopBar (tenant switcher, search, notifications, user menu) - Auth pages: Login, PasswordResetRequest, PasswordResetConfirm - Protected routes with auth guard - API client (axios with interceptors: session cookie, 401 redirect, 422 validation) - TanStack Query hooks for auth, users, companies, contacts, notifications - Zustand stores: authStore, uiStore - i18n setup (de/en locales) with react-i18next - UI component library: Button, Input, Select, Modal, Toast, Table, Card, Badge, Avatar, Pagination, EmptyState, Skeleton, ConfirmDialog - Accessibility: ARIA labels, 44px touch targets, keyboard nav, reduced-motion, sr-only - Design tokens from prototype as CSS custom properties - 111 tests passing across 20 test files - tsc --noEmit: 0 errors - npm run build: success (471KB JS, 24KB CSS)
36 lines
1013 B
TypeScript
36 lines
1013 B
TypeScript
import { describe, it, expect, beforeAll } from 'vitest';
|
|
import i18n from '@/i18n';
|
|
|
|
describe('i18n', () => {
|
|
beforeAll(async () => {
|
|
await i18n.changeLanguage('de');
|
|
});
|
|
|
|
it('loads German locale by default', () => {
|
|
expect(i18n.language).toBe('de');
|
|
});
|
|
|
|
it('translates key in German', () => {
|
|
expect(i18n.t('nav.dashboard')).toBe('Dashboard');
|
|
expect(i18n.t('nav.companies')).toBe('Firmen');
|
|
expect(i18n.t('auth.login')).toBe('Anmelden');
|
|
});
|
|
|
|
it('can switch to English', async () => {
|
|
await i18n.changeLanguage('en');
|
|
expect(i18n.language).toBe('en');
|
|
expect(i18n.t('auth.login')).toBe('Sign In');
|
|
expect(i18n.t('nav.companies')).toBe('Companies');
|
|
});
|
|
|
|
it('falls back to German for missing English keys', async () => {
|
|
await i18n.changeLanguage('en');
|
|
expect(i18n.t('app.name')).toBe('leocrm');
|
|
});
|
|
|
|
it('switches back to German', async () => {
|
|
await i18n.changeLanguage('de');
|
|
expect(i18n.t('auth.login')).toBe('Anmelden');
|
|
});
|
|
});
|