mirror of
https://github.com/immich-app/immich.git
synced 2026-07-03 19:35:22 -07:00
30a73c1105
Co-authored-by: shenlong-tanwen <139912620+shalong-tanwen@users.noreply.github.com>
36 lines
975 B
Dart
36 lines
975 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:immich_ui/src/snackbar.dart';
|
|
|
|
import 'test_utils.dart';
|
|
|
|
void main() {
|
|
group('SnackbarManager', () {
|
|
testWidgets('shows the message', (tester) async {
|
|
await tester.pumpTestWidget(const SizedBox());
|
|
|
|
snackbar.success('hello');
|
|
await tester.pump();
|
|
|
|
expect(find.text('hello'), findsOneWidget);
|
|
expect(find.byType(SnackBar), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('replaces the current snackbar', (tester) async {
|
|
await tester.pumpTestWidget(const SizedBox());
|
|
|
|
snackbar.info('first');
|
|
await tester.pump();
|
|
snackbar.error('second');
|
|
await tester.pump();
|
|
|
|
expect(find.text('first'), findsNothing);
|
|
expect(find.text('second'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('no-ops when the messenger is unmounted', (tester) async {
|
|
expect(snackbar.show('x', .info), isNull);
|
|
});
|
|
});
|
|
}
|