forked from BasedHardware/omi
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathshimmer_with_timeout_test.dart
More file actions
31 lines (23 loc) · 1011 Bytes
/
Copy pathshimmer_with_timeout_test.dart
File metadata and controls
31 lines (23 loc) · 1011 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:shimmer/shimmer.dart';
import 'package:omi/widgets/shimmer_with_timeout.dart';
void main() {
testWidgets('shows shimmer before timeout and hides after', (tester) async {
await tester.pumpWidget(
const MaterialApp(home: ShimmerWithTimeout(timeoutSeconds: 1, child: SizedBox(width: 10, height: 10))),
);
expect(find.byType(Shimmer), findsOneWidget);
await tester.pump(const Duration(seconds: 1));
await tester.pump();
expect(find.byType(Shimmer), findsNothing);
});
testWidgets('does not throw when disposed before timeout', (tester) async {
await tester.pumpWidget(
const MaterialApp(home: ShimmerWithTimeout(timeoutSeconds: 2, child: SizedBox(width: 10, height: 10))),
);
await tester.pumpWidget(const MaterialApp(home: SizedBox.shrink()));
await tester.pump(const Duration(seconds: 3));
expect(tester.takeException(), isNull);
});
}