Files
HouseHoldKeaper/test/l10n/localization_test.dart
Jean-Luc Makiola 51738f78bc feat(01-01): add core infrastructure, localization, and Wave 0 tests
- AppDatabase with schemaVersion 1, in-memory executor for testing
- Database provider with @Riverpod(keepAlive: true)
- AppTheme with sage green seed ColorScheme and warm surface overrides
- ThemeNotifier with SharedPreferences persistence, defaults to system
- Full German ARB localization (15 keys) with proper umlauts
- Minimal main.dart with ProviderScope placeholder
- Drift schema v1 captured via make-migrations
- All .g.dart files generated via build_runner
- Wave 0 tests: database (3), color scheme (6), theme (3), localization (2) -- 14 total, all passing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 19:59:44 +01:00

57 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:household_keeper/l10n/app_localizations.dart';
void main() {
group('AppLocalizations (German)', () {
late AppLocalizations l10n;
testWidgets('loads German localization and displays tabHome',
(tester) async {
late AppLocalizations capturedL10n;
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: const [Locale('de')],
locale: const Locale('de'),
home: Builder(
builder: (context) {
capturedL10n = AppLocalizations.of(context);
return Text(capturedL10n.tabHome);
},
),
),
);
await tester.pumpAndSettle();
// Verify the rendered text contains the expected German string
expect(find.text('\u00dcbersicht'), findsOneWidget);
});
testWidgets('all critical keys are non-empty', (tester) async {
await tester.pumpWidget(
MaterialApp(
localizationsDelegates: AppLocalizations.localizationsDelegates,
supportedLocales: const [Locale('de')],
locale: const Locale('de'),
home: Builder(
builder: (context) {
l10n = AppLocalizations.of(context);
return const SizedBox.shrink();
},
),
),
);
await tester.pumpAndSettle();
expect(l10n.appTitle, isNotEmpty);
expect(l10n.tabHome, isNotEmpty);
expect(l10n.tabRooms, isNotEmpty);
expect(l10n.tabSettings, isNotEmpty);
});
});
}