forked from baron/baron-sso
모바일 로그인창 테스트 강화
This commit is contained in:
50
userfront/test/toml_asset_loader_test.dart
Normal file
50
userfront/test/toml_asset_loader_test.dart
Normal file
@@ -0,0 +1,50 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:userfront/core/i18n/toml_asset_loader.dart';
|
||||
import 'package:userfront/i18n_data.dart';
|
||||
|
||||
void main() {
|
||||
test('TomlAssetLoader keeps flat keys for fast startup lookup', () async {
|
||||
const loader = TomlAssetLoader();
|
||||
|
||||
final translations = await loader.load(
|
||||
'assets/translations',
|
||||
const Locale('en'),
|
||||
);
|
||||
|
||||
expect(translations['domain.company.baron'], 'Baron');
|
||||
expect(translations['domain'], isNull);
|
||||
});
|
||||
|
||||
test('English signup policy copy stays small enough for first render', () {
|
||||
const sensitiveKeys = [
|
||||
'msg.userfront.signup.privacy_full',
|
||||
'msg.userfront.signup.tos_full',
|
||||
];
|
||||
|
||||
for (final key in sensitiveKeys) {
|
||||
final value = enStrings[key];
|
||||
expect(value, isNotNull, reason: key);
|
||||
expect(value!.length, lessThan(1024), reason: key);
|
||||
expect(value.contains(r'\\\\'), isFalse, reason: key);
|
||||
}
|
||||
});
|
||||
|
||||
test(
|
||||
'TomlAssetLoader excludes non-userfront dictionaries at startup',
|
||||
() async {
|
||||
const loader = TomlAssetLoader();
|
||||
|
||||
final translations = await loader.load(
|
||||
'assets/translations',
|
||||
const Locale('en'),
|
||||
);
|
||||
|
||||
expect(translations['ui.admin.nav.api_keys'], isNull);
|
||||
expect(translations['ui.dev.console_title'], isNull);
|
||||
expect(translations['ui.userfront.login.action.submit'], 'Sign in');
|
||||
expect(translations['ui.common.theme_light'], 'Light');
|
||||
},
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user