mobile bluesky app made with flutter
lazurite.stormlightlabs.org/
mobile
bluesky
flutter
1import 'package:flutter/material.dart';
2import 'package:flutter_animate/flutter_animate.dart';
3import 'package:flutter_test/flutter_test.dart';
4import 'package:lazurite/shared/presentation/widgets/empty_state.dart';
5
6void main() {
7 Widget buildSubject(Widget child, {bool disableAnimations = false}) {
8 return MaterialApp(
9 home: MediaQuery(
10 data: MediaQueryData(disableAnimations: disableAnimations),
11 child: Scaffold(body: child),
12 ),
13 );
14 }
15
16 testWidgets('renders message and icon', (tester) async {
17 await tester.pumpWidget(buildSubject(const EmptyState(message: 'No items', icon: Icons.search_off_outlined)));
18
19 expect(find.text('No items'), findsOneWidget);
20 expect(find.byIcon(Icons.search_off_outlined), findsOneWidget);
21 });
22
23 testWidgets('renders subtitle and action', (tester) async {
24 await tester.pumpWidget(
25 buildSubject(
26 EmptyState(
27 message: 'No feeds pinned',
28 subtitle: 'Add feeds to continue.',
29 action: FilledButton(onPressed: () {}, child: const Text('Manage Feeds')),
30 ),
31 ),
32 );
33
34 expect(find.text('No feeds pinned'), findsOneWidget);
35 expect(find.text('Add feeds to continue.'), findsOneWidget);
36 expect(find.text('Manage Feeds'), findsOneWidget);
37 });
38
39 testWidgets('skips entrance animation when reduced motion is enabled', (tester) async {
40 await tester.pumpWidget(buildSubject(const EmptyState(message: 'Nothing here'), disableAnimations: true));
41
42 expect(find.byType(Animate), findsNothing);
43 expect(find.text('Nothing here'), findsOneWidget);
44 });
45}