첫 커밋: 로컬 프로젝트 업로드
This commit is contained in:
36
baron-sso/userfront/test/locale_registry_test.dart
Normal file
36
baron-sso/userfront/test/locale_registry_test.dart
Normal file
@@ -0,0 +1,36 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:userfront/core/i18n/locale_registry.dart';
|
||||
|
||||
void main() {
|
||||
tearDown(() {
|
||||
LocaleRegistry.resetForTest();
|
||||
});
|
||||
|
||||
group('locale_registry', () {
|
||||
test(
|
||||
'extractSupportedLocaleCodesFromAssets excludes template and invalid',
|
||||
() {
|
||||
final locales = extractSupportedLocaleCodesFromAssets([
|
||||
'assets/translations/template.toml',
|
||||
'assets/translations/en.toml',
|
||||
'assets/translations/ko.toml',
|
||||
'assets/translations/pt_BR.toml',
|
||||
'assets/translations/readme.txt',
|
||||
'assets/translations/nested/ja.toml',
|
||||
]);
|
||||
|
||||
expect(locales, ['en', 'ko']);
|
||||
},
|
||||
);
|
||||
|
||||
test('fallback locale prefers en when available', () {
|
||||
LocaleRegistry.setSupportedLocaleCodesForTest(['ko', 'en']);
|
||||
expect(LocaleRegistry.fallbackLocaleCode, 'en');
|
||||
});
|
||||
|
||||
test('fallback locale uses first sorted code when en is absent', () {
|
||||
LocaleRegistry.setSupportedLocaleCodesForTest(['ko', 'ja']);
|
||||
expect(LocaleRegistry.fallbackLocaleCode, 'ja');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user