forked from baron/baron-sso
59 lines
1.7 KiB
Dart
59 lines
1.7 KiB
Dart
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('Korean linked app revoke action label stays unbreakable', () {
|
|
expect(koStrings['ui.userfront.dashboard.revoke.title'], '연동해지');
|
|
});
|
|
|
|
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['err.userfront.auth_proxy.login_failed'],
|
|
'Login failed.',
|
|
);
|
|
expect(translations['ui.userfront.login.action.submit'], 'Sign in');
|
|
expect(translations['ui.common.theme_light'], 'Light');
|
|
},
|
|
);
|
|
}
|