test sweep: cover I18n locale getters (T-91)

Adds one test covering the currentLocale / defaultLocale /
availableLocales getters on the I18n class. Existing suite exercised
the lookup behaviour but never read back the three locale fields,
leaving them as the last reachable gaps in lib/kernel/src/i18n/.

Coverage: kernel/src/i18n/i18n.dart 54/58 -> 57/58. The 1 remaining
line is the I18nReplacer const-constructor body (lcov phantom).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-12 11:21:24 +02:00
co-authored by Claude Opus 4.7
parent eeb2ee4b82
commit 7ad427bd88
+11
View File
@@ -29,6 +29,17 @@ void main() {
return i;
}
test('locale getters reflect constructor arguments', () {
final i = build(
catalogs: const {},
initial: const Locale('nl', 'NL'),
defaultLocale: const Locale('en', 'US'),
);
expect(i.currentLocale, const Locale('nl', 'NL'));
expect(i.defaultLocale, const Locale('en', 'US'));
expect(i.availableLocales, [const Locale('en', 'US'), const Locale('nl', 'NL')]);
});
test('missing key with placeholder returns placeholder', () async {
final i = build(catalogs: const {});
await i.ensureNamespaceLoaded('builtin.x');