fix(flutter): 评论入口增加登录闸

This commit is contained in:
Zhou Weidong committed 2026-10-20 16:12:27 +08:00
1 parent a5c84b0297
commit 870a170fad
3 files changed
+59 -2

No files matched your search

+28
View File
@@ -69,6 +69,34 @@ void main() {
);
});
testWidgets('should_gate_comments_before_opening_sheet_when_signed_out', (
tester,
) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);
await tester.tap(find.byKey(const Key('player-rail-comments')));
await tester.pumpAndSettle();
expect(find.text('Sign in to continue'), findsOneWidget);
expect(find.byKey(const Key('player-comments-sheet')), findsNothing);
});
testWidgets('should_open_feed_comments_when_signed_in', (tester) async {
SharedPreferencesAsyncPlatform.instance =
InMemorySharedPreferencesAsync.withData({
'auth.accessToken': 'access',
'auth.refreshToken': 'refresh',
'auth.user': '{"uid":"9","nickname":"Viewer","avatarUrl":""}',
});
await _pumpApp(tester);
await tester.tap(find.byKey(const Key('rail-comments')));
await tester.pumpAndSettle();
expect(find.byKey(const Key('player-comments-sheet')), findsOneWidget);
});
testWidgets('should_show_center_toggle_only_when_paused', (tester) async {
await _pumpApp(tester);
await _openSeriesPlayer(tester);