Merge remote-tracking branch 'upstream/main'

This commit is contained in:
misha
2026-01-20 12:00:44 +03:00
50 changed files with 984 additions and 1131 deletions

View File

@@ -12,10 +12,7 @@ void main() {
test('createRoutes содержит маршрут authScreen', () {
final routes = AuthRoutes.createRoutes();
final authRoute = routes.firstWhere(
(route) => route is GoRoute && route.path == '/auth-screen',
orElse: () => throw Exception('Route not found'),
);
final authRoute = routes.firstWhere((route) => route is GoRoute && route.path == '/auth-screen', orElse: () => throw Exception('Route not found'));
expect(authRoute, isA<GoRoute>());
});
@@ -67,10 +64,7 @@ void main() {
test('createRoutes содержит маршрут verifyScreen', () {
final routes = AuthRoutes.createRoutes();
final verifyRoute = routes.firstWhere(
(route) => route is GoRoute && route.path == '/verify-screen',
orElse: () => throw Exception('Route not found'),
);
final verifyRoute = routes.firstWhere((route) => route is GoRoute && route.path == '/verify-screen', orElse: () => throw Exception('Route not found'));
expect(verifyRoute, isA<GoRoute>());
});
@@ -92,44 +86,25 @@ void main() {
expect(registerViaSocialRoute, isA<GoRoute>());
});
test('authScreen имеет redirect функцию', () {
final routes = AuthRoutes.createRoutes();
final authRoute = routes.first as GoRoute;
expect(authRoute.redirect, isNotNull);
});
test('forgetPasswordScreen builder обрабатывает extra данные', () {
final routes = AuthRoutes.createRoutes();
final authRoute = routes.first as GoRoute;
final forgetPasswordRoute = authRoute.routes.firstWhere(
(route) => route is GoRoute && route.path == 'forget-password-screen',
orElse: () => throw Exception('Route not found'),
) as GoRoute;
final forgetPasswordRoute =
authRoute.routes.firstWhere((route) => route is GoRoute && route.path == 'forget-password-screen', orElse: () => throw Exception('Route not found'))
as GoRoute;
expect(forgetPasswordRoute.builder, isNotNull);
});
test('verifyScreen builder обрабатывает extra данные', () {
final routes = AuthRoutes.createRoutes();
final verifyRoute = routes.firstWhere(
(route) => route is GoRoute && route.path == '/verify-screen',
) as GoRoute;
final verifyRoute = routes.firstWhere((route) => route is GoRoute && route.path == '/verify-screen') as GoRoute;
expect(verifyRoute.builder, isNotNull);
});
test('registerViaSocialScreen builder обрабатывает extra данные', () {
final routes = AuthRoutes.createRoutes();
final registerViaSocialRoute = routes.firstWhere(
(route) => route is GoRoute && route.path == '/register-via-social-screen',
) as GoRoute;
final registerViaSocialRoute = routes.firstWhere((route) => route is GoRoute && route.path == '/register-via-social-screen') as GoRoute;
expect(registerViaSocialRoute.builder, isNotNull);
});
});
}

View File

@@ -6,6 +6,10 @@ void main() {
group('TokenStorage', () {
setUp(() async {
SharedPreferences.setMockInitialValues({});
// Clear cached instance to ensure fresh state for each test
TokenStorage.clearCache();
final prefs = await SharedPreferences.getInstance();
await prefs.clear();
});
test('haveTokenInStorage returns false when no token is stored', () async {
@@ -66,6 +70,10 @@ void main() {
group('SocketIdStorage', () {
setUp(() async {
SharedPreferences.setMockInitialValues({});
// Clear cached instance to ensure fresh state for each test
TokenStorage.clearCache();
final prefs = await SharedPreferences.getInstance();
await prefs.clear();
});
test('haveSocketIdInStorage returns false when no socketId is stored', () async {

View File

@@ -29,6 +29,7 @@ void main() {
const MarketingBottomSheet(),
),
);
await tester.pumpAndSettle();
expect(find.byType(MarketingBottomSheet), findsOneWidget);
});
@@ -59,6 +60,7 @@ void main() {
),
);
await tester.pump();
await tester.tap(find.text('Show'));
await tester.pumpAndSettle();

View File

@@ -24,6 +24,7 @@ void main() {
testWidgets('returns SizedBox.shrink when option is null', (tester) async {
await tester.pumpWidget(createTestWidget(const OptionWidget(option: null, duration: 7)));
await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
expect(find.byType(SizedBox), findsWidgets);
@@ -33,6 +34,7 @@ void main() {
const option = PacketOptions(items: ['Item 1', 'Item 2'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
expect(find.text('Short'), findsOneWidget);
@@ -43,6 +45,7 @@ void main() {
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: true);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7)));
await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
});
@@ -51,6 +54,7 @@ void main() {
const option = PacketOptions(items: ['Item 1'], price: 1000.0, short: 'Short', description: 'Description', hasPersonalDiet: false);
await tester.pumpWidget(createTestWidget(const OptionWidget(option: option, duration: 7, disableDuration: true)));
await tester.pumpAndSettle();
expect(find.byType(OptionWidget), findsOneWidget);
});

View File

@@ -31,6 +31,7 @@ void main() {
),
);
await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -68,6 +69,7 @@ void main() {
),
);
await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -103,6 +105,7 @@ void main() {
),
);
await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();
@@ -134,6 +137,7 @@ void main() {
),
);
await tester.pump();
await tester.tap(find.text('Show Error'));
await tester.pumpAndSettle();