feat: 实现用户画像、占卜历史与后端用户管理模块

This commit is contained in:
ZL-Q
2026-04-06 01:28:10 +08:00
parent d87b2e1e3a
commit 8a18b3528b
77 changed files with 5850 additions and 2604 deletions
@@ -8,7 +8,7 @@ import 'package:meeyao_qianwen/features/divination/presentation/screens/divinati
import 'package:meeyao_qianwen/l10n/app_localizations.dart';
void main() {
testWidgets('result screen shows key sections', (tester) async {
DivinationResultData buildResultData() {
final params = DivinationParams(
method: DivinationMethod.auto,
questionType: QuestionType.health,
@@ -17,7 +17,7 @@ void main() {
coinBalance: 10,
userId: 'u_test',
);
final data = DivinationResultData(
return DivinationResultData(
params: params,
binaryCode: '101001',
changedBinaryCode: '100001',
@@ -158,6 +158,10 @@ void main() {
),
],
);
}
testWidgets('result screen shows key sections', (tester) async {
final data = buildResultData();
await tester.pumpWidget(
MaterialApp(
@@ -186,4 +190,55 @@ void main() {
expect(find.text(''), findsWidgets);
expect(find.text('×'), findsWidgets);
});
testWidgets('result screen back returns directly to root home', (
tester,
) async {
final data = buildResultData();
await tester.pumpWidget(
MaterialApp(
theme: AppTheme.light(),
locale: const Locale('zh'),
localizationsDelegates: const [
AppLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: AppLocalizations.supportedLocales,
home: Builder(
builder: (context) {
return Scaffold(
body: Center(
child: FilledButton(
onPressed: () {
Navigator.of(context).push<void>(
MaterialPageRoute<void>(
builder: (_) => DivinationResultScreen(data: data),
),
);
},
child: const Text('open_result'),
),
),
);
},
),
),
);
await tester.tap(find.text('open_result'));
await tester.pumpAndSettle();
await tester.pump(const Duration(milliseconds: 1000));
await tester.pumpAndSettle();
expect(find.byType(DivinationResultScreen), findsOneWidget);
await tester.tap(find.byIcon(Icons.arrow_back_ios_new_rounded));
await tester.pumpAndSettle();
expect(find.text('open_result'), findsOneWidget);
expect(find.byType(DivinationResultScreen), findsNothing);
});
}