forked from eatvio/eatvio_app
chore(version): update app version to 1.3.5+85 and improve test coverage reporting in CI
This commit is contained in:
@@ -0,0 +1,98 @@
|
||||
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
||||
import 'package:eatvio_app/core/comments/presentation/comments_actions_bottom_sheet.dart';
|
||||
import 'package:eatvio_app/generated/l10n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_localizations/flutter_localizations.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('CommentsActionsBottomSheet', () {
|
||||
Widget createTestWidget(Widget child) {
|
||||
return MaterialApp(
|
||||
theme: ThemeHelper().themeData(),
|
||||
localizationsDelegates: [
|
||||
S.delegate,
|
||||
GlobalMaterialLocalizations.delegate,
|
||||
GlobalWidgetsLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
],
|
||||
supportedLocales: S.delegate.supportedLocales,
|
||||
home: Scaffold(
|
||||
body: child,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
testWidgets('displays comments actions bottom sheet', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
CommentsActionsBottomSheet(
|
||||
isMyComment: false,
|
||||
reply: () {},
|
||||
copy: () {},
|
||||
edit: (text) {},
|
||||
delete: () {},
|
||||
complain: () {},
|
||||
commentText: 'Test comment',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentsActionsBottomSheet), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays edit option for my comment', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
CommentsActionsBottomSheet(
|
||||
isMyComment: true,
|
||||
reply: null,
|
||||
copy: () {},
|
||||
edit: (text) {},
|
||||
delete: () {},
|
||||
complain: () {},
|
||||
commentText: 'Test comment',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentsActionsBottomSheet), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('displays reply option when reply is not null', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
CommentsActionsBottomSheet(
|
||||
isMyComment: false,
|
||||
reply: () {},
|
||||
copy: () {},
|
||||
edit: (text) {},
|
||||
delete: () {},
|
||||
complain: () {},
|
||||
commentText: 'Test comment',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentsActionsBottomSheet), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('shows edit mode when edit is tapped', (tester) async {
|
||||
await tester.pumpWidget(
|
||||
createTestWidget(
|
||||
CommentsActionsBottomSheet(
|
||||
isMyComment: true,
|
||||
reply: null,
|
||||
copy: () {},
|
||||
edit: (text) {},
|
||||
delete: () {},
|
||||
complain: () {},
|
||||
commentText: 'Test comment',
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
expect(find.byType(CommentsActionsBottomSheet), findsOneWidget);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user