chain-studio/test/load_docs_test.dart
flemming-it 891acd2ba2
Some checks failed
Security / Security check (push) Failing after 2s
refactor: rename internal Fai* design system + fai_ helpers to chain
The Studio design system, widgets and helpers carried a Fai* / fai_
prefix (FaiSpace, FaiColors, FaiTheme, FaiLog, 17 fai_*.dart files, the
faiBinary* l10n keys). Studio is the Ch∆In product, so rename them to
Chain* / chain_ — carefully preserving English fail/failure/failed.
Also fix stale references: the 'fai' binary in l10n strings -> 'chain',
FAI_* env vars (FAI_BIN/DATA_DIR/MODULES_DIR/TODAY/BOOTSTRAP_TOKEN) ->
CHAIN_*, fai_platform -> fai_chain, fai_hub -> chain_hub. Vendor
security-hook tooling (FAI_BANNED_TERMS_FILE) + the .fai bundle ext left.
flutter analyze + test: clean (20 passed).

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-16 17:53:17 +02:00

52 lines
1.9 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter/services.dart' show rootBundle;
import 'package:flutter_test/flutter_test.dart';
import 'package:flutter_markdown_plus/flutter_markdown_plus.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:chain_studio/l10n/app_localizations.dart';
import 'package:chain_studio/theme/theme.dart';
/// Recreates the exact DocReaderSheet code path that
/// welcome.dart uses, including ChainTheme.markdownStyle, so a
/// regression in either rootBundle, the markdown parser, or
/// the style sheet surfaces here instead of only at runtime
/// when an operator clicks a doc card.
void main() {
TestWidgetsFlutterBinding.ensureInitialized();
testWidgets('DocReaderSheet renders all four german + english docs',
(tester) async {
final theme = ChainTheme.light();
for (final slug in ['architecture', 'security', 'audit', 'flows']) {
for (final locale in ['de', 'en']) {
final path = locale == 'de'
? 'assets/docs/${slug}_de.md'
: 'assets/docs/$slug.md';
final text = await rootBundle.loadString(path);
await tester.pumpWidget(MaterialApp(
locale: Locale(locale),
supportedLocales: const [Locale('en'), Locale('de')],
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
theme: theme,
home: Scaffold(
body: Markdown(
data: text,
padding: const EdgeInsets.all(8),
selectable: true,
styleSheet: ChainTheme.markdownStyle(theme),
),
),
));
await tester.pump();
// ignore: avoid_print
print('rendered $path');
}
}
});
}