chain-studio/test/load_docs_test.dart
flemming-it 68d23ab7dd
Some checks are pending
Security / Security check (push) Waiting to run
refactor: rename app fai_studio -> chain_studio
Studio is the Ch∆In product's GUI, not a F∆I-vendor app. Rename the
Flutter package, all package: imports, and the build identity across
platforms: linux/windows CMake BINARY_NAME + project, Windows Runner.rc
fields, macOS PRODUCT_NAME / bundle id (ai.flemming.chain.chainStudio) /
.app + scheme BuildableName. Update the client-SDK + flow-editor deps to
their renamed chain_* packages (path + git URL). Company/copyright fields
now read Flemming.AI. flutter analyze: clean.

Signed-off-by: flemming-it <stefan.a.flemming@googlemail.com>
2026-06-16 17:48:11 +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 FaiTheme.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 = FaiTheme.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: FaiTheme.markdownStyle(theme),
),
),
));
await tester.pump();
// ignore: avoid_print
print('rendered $path');
}
}
});
}