feat(feed): fixed comments state updating in feed, feat(consultantRegistration): fixed registration flow for users with unverified phone, feat(tests): fixed tests coverage

This commit is contained in:
misha
2026-04-01 10:37:59 +03:00
parent ee2dd75a94
commit a13b623ca2
20 changed files with 949 additions and 343 deletions

View File

@@ -3,6 +3,7 @@ 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/dev_tools/presentation/dev_tools_screen.dart';
import 'package:dio/dio.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_test/flutter_test.dart';
@@ -16,6 +17,7 @@ void main() {
setUp(() async {
await sl.reset();
sl.registerLazySingleton<AppConfig>(() => AppConfig(buildType: AppBuildType.tests)..setBaseUrl('http://localhost'));
sl.registerLazySingleton<Dio>(() => Dio(BaseOptions(baseUrl: 'http://localhost')));
});
Widget wrap(Widget child) {
@@ -39,5 +41,29 @@ void main() {
expect(find.byType(DevToolsScreenContent), findsOneWidget);
});
testWidgets('updates base url from input by done button', (tester) async {
await tester.pumpWidget(wrap(const DevToolsScreen()));
await tester.pump();
await tester.enterText(find.byType(TextFormField).first, 'HTTP://EXAMPLE.COM');
await tester.tap(find.byIcon(Icons.done));
await tester.pump();
expect(find.byType(DevToolsScreenContent), findsOneWidget);
});
testWidgets('toggle base url button is tappable', (tester) async {
await tester.pumpWidget(wrap(const DevToolsScreen()));
await tester.pump();
final toggleButton = find.text('Set production base url');
expect(toggleButton, findsOneWidget);
await tester.tap(toggleButton);
await tester.pump();
expect(find.byType(DevToolsScreenContent), findsOneWidget);
});
});
}

View File

@@ -0,0 +1,107 @@
import 'package:eatvio_app/features/dev_tools/test_cases.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('DevTools TestCases bulk', () {
test('all case names are readable', () {
final cases = <TestCases>[
CreateRecipeTask(),
Test850task(),
GetChatRoomPreviews(),
GetChatRoom(),
SendMessage(),
GetChatMessages(),
GetChatRoomIdByUserSlug(),
GetBlogPostList(),
GetRecipes(),
GetDiets(),
GetPlans(),
GetBlogPostComments(),
SendBlogPostComment(),
GetDietsComments(),
SendDietsComment(),
GetPlansComments(),
SendPlansComment(),
GetRecipesComments(),
AuthServiceTest(),
DiaryServiceTest(),
BlockedUserServiceTest(),
PlanServiceTest(),
AboutRecipeServiceTest(),
BlogPostServiceTest(),
CalendarServiceTest(),
CardsServiceTest(),
ConsultantServiceTest(),
ConsultationServiceTest(),
CreateDietServiceTest(),
CreatePlanServiceTest(),
GlossaryServiceTest(),
MyDietsServiceTest(),
MyPlansServiceTest(),
MyRecipesServiceTest(),
NotificationsServiceTest(),
PlansServiceTest(),
ProfileServiceTest(),
RegistrationServiceTest(),
ResetPasswordServiceTest(),
SettingsServiceTest(),
WsServiceTest(),
];
for (final c in cases) {
expect(c.name, isNotEmpty);
}
});
test('run() does not throw for all cases', () async {
final cases = <TestCases>[
CreateRecipeTask(),
Test850task(),
GetChatRoomPreviews(),
GetChatRoom(),
SendMessage(),
GetChatMessages(),
GetChatRoomIdByUserSlug(),
GetBlogPostList(),
GetRecipes(),
GetDiets(),
GetPlans(),
GetBlogPostComments(),
SendBlogPostComment(),
GetDietsComments(),
SendDietsComment(),
GetPlansComments(),
SendPlansComment(),
GetRecipesComments(),
AuthServiceTest(),
DiaryServiceTest(),
BlockedUserServiceTest(),
PlanServiceTest(),
AboutRecipeServiceTest(),
BlogPostServiceTest(),
CalendarServiceTest(),
CardsServiceTest(),
ConsultantServiceTest(),
ConsultationServiceTest(),
CreateDietServiceTest(),
CreatePlanServiceTest(),
GlossaryServiceTest(),
MyDietsServiceTest(),
MyPlansServiceTest(),
MyRecipesServiceTest(),
NotificationsServiceTest(),
PlansServiceTest(),
ProfileServiceTest(),
RegistrationServiceTest(),
ResetPasswordServiceTest(),
SettingsServiceTest(),
WsServiceTest(),
];
for (final c in cases) {
final result = await c.run(baseUrl: 'http://localhost');
expect(result, isA<TestResult>());
}
});
});
}