Files
clide/test/a11y/i18n_coverage_test.dart
T
jpmschweitzerandClaude Opus 4.6 46329700d5 dissolve app/ into repo root (D-056)
Single Flutter package at the repo root. All code, tests, assets,
and platform directories moved from app/ to root. Package renamed
from clide_app to clide — all imports rewritten. Merged pubspec
combines core (ffi) and app (flutter, yaml, xterm) dependencies.
Makefile simplified: no APP_PRESENT conditionals, no cd, no daemon
lifecycle. 317 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-23 00:37:20 +02:00

66 lines
1.8 KiB
Dart

import 'dart:ui';
import 'package:clide/kernel/kernel.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_test/flutter_test.dart';
/// Asserts every bundled i18n catalog is well-formed and every key the
/// Tier-0 built-ins ask for actually resolves.
///
/// The second check is important: in a text-driven i18n system missing
/// keys show the placeholder, so a runtime lookup test wouldn't "fail"
/// on a typo — we have to assert the keys exist up front.
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
/// (namespace, key) pairs referenced by Tier-0 built-ins. Extend when
/// new keys land.
const referenced = <String, List<String>>{
'builtin.welcome': [
'title',
'subtitle',
'open-project',
'open-project.hint',
'tab.title',
],
'builtin.ipc-status': [
'connected',
'connected.hint',
'disconnected',
'disconnected.hint',
],
'builtin.theme-picker': [
'modal.title',
'modal.cancel',
'modal.cancel.hint',
'row.select.hint',
],
'builtin.default-layout': [
'command.reset',
'preset.classic',
],
};
group('i18n coverage (Tier 0)', () {
for (final entry in referenced.entries) {
final ns = entry.key;
test('$ns catalog contains every referenced key', () async {
final loader = AssetCatalogLoader(bundle: rootBundle);
final catalog = await loader.load(ns, const Locale('en', 'US'));
expect(
catalog,
isNotEmpty,
reason: 'catalog for "$ns" failed to load (asset path wrong?)',
);
for (final key in entry.value) {
expect(
catalog.containsKey(key),
isTrue,
reason: 'namespace "$ns" catalog is missing key "$key"',
);
}
});
}
});
}