feat(tests): test coverage is 70.4

This commit is contained in:
misha
2026-01-23 12:40:17 +03:00
parent f6809a06b3
commit 92205c09d6
38 changed files with 1829 additions and 133 deletions

View File

@@ -0,0 +1,53 @@
import 'package:eatvio_app/core/app_config.dart';
import 'package:eatvio_app/core/app_initializer.dart';
import 'package:eatvio_app/core/locator_service.dart';
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/features/update_screen/presentation/update_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('UpdateScreen smoke', () {
setUpAll(() async {
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost\nAPP_STORE_URL=https://apps.apple.com\nRUSTORE_URL=https://apps.rustore.ru');
});
setUp(() async {
await sl.reset();
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
});
Widget wrap(Widget child) {
return MaterialApp(
theme: ThemeHelper().themeData(),
home: child,
);
}
testWidgets('renders update screen', (tester) async {
await tester.pumpWidget(wrap(const UpdateScreen()));
await tester.pump();
expect(find.byType(UpdateScreen), findsOneWidget);
expect(find.text('Пора обновиться! ⚡'), findsOneWidget);
expect(find.text('Обновить'), findsOneWidget);
});
testWidgets('displays update message', (tester) async {
await tester.pumpWidget(wrap(const UpdateScreen()));
await tester.pump();
// Проверяем наличие текста об обновлении (может быть в многострочном тексте)
expect(find.textContaining('обновление'), findsWidgets);
});
testWidgets('displays update button', (tester) async {
await tester.pumpWidget(wrap(const UpdateScreen()));
await tester.pump();
expect(find.text('Обновить'), findsOneWidget);
expect(find.byType(InkWell), findsOneWidget);
});
});
}