syn with upstream (#985)

Co-authored-by: misha <mikhail_zakharov_15482356@mail.ru>
Co-authored-by: misha <misha@noreply.localhost>
Reviewed-on: eatvio/eatvio_app#985
This commit is contained in:
2026-05-27 18:37:17 +00:00
parent 5d86b7c71b
commit 204a55917a
66 changed files with 3976 additions and 105 deletions

View File

@@ -0,0 +1,92 @@
import 'package:eatvio_app/features/bottom_navigation_bar/presentation/widgets/bottom_nav_scope.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('BottomNavController', () {
test('switchToRoute is a no-op until a callback is registered', () {
final controller = BottomNavController();
// Should not throw
controller.switchToRoute('/home');
controller.switchToRoute('/home', 'extra');
});
test('switchToRoute forwards path and extra to registered callback', () {
final controller = BottomNavController();
String? receivedPath;
Object? receivedExtra;
controller.register((path, extra) {
receivedPath = path;
receivedExtra = extra;
});
controller.switchToRoute('/feed', {'tab': 'recipes'});
expect(receivedPath, '/feed');
expect(receivedExtra, {'tab': 'recipes'});
});
test('switchToRoute passes null extra by default', () {
final controller = BottomNavController();
Object? receivedExtra = 'sentinel';
controller.register((path, extra) {
receivedExtra = extra;
});
controller.switchToRoute('/profile');
expect(receivedExtra, isNull);
});
});
group('BottomNavScope', () {
testWidgets('maybeOf returns null when scope is not present', (tester) async {
late BottomNavController? captured;
await tester.pumpWidget(
MaterialApp(
home: Builder(
builder: (ctx) {
captured = BottomNavScope.maybeOf(ctx);
return const SizedBox.shrink();
},
),
),
);
expect(captured, isNull);
});
testWidgets('of returns controller from ancestor scope', (tester) async {
final controller = BottomNavController();
late BottomNavController captured;
await tester.pumpWidget(
MaterialApp(
home: BottomNavScope(
controller: controller,
child: Builder(
builder: (ctx) {
captured = BottomNavScope.of(ctx);
return const SizedBox.shrink();
},
),
),
),
);
expect(identical(captured, controller), isTrue);
});
testWidgets('updateShouldNotify returns true when controller changes', (tester) async {
final c1 = BottomNavController();
final c2 = BottomNavController();
const child = SizedBox.shrink();
final widget1 = BottomNavScope(controller: c1, child: child);
final widget2 = BottomNavScope(controller: c2, child: child);
expect(widget2.updateShouldNotify(widget1), isTrue);
final widget3 = BottomNavScope(controller: c1, child: child);
expect(widget3.updateShouldNotify(widget1), isFalse);
});
});
}

View File

@@ -7,12 +7,12 @@ import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('ExpandableText smoke', () {
group('ExpandableText', () {
setUpAll(() async {
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
});
Widget wrap(Widget child) {
Widget wrap(Widget child, {Size size = const Size(360, 800)}) {
return MaterialApp(
theme: ThemeHelper().themeData(),
localizationsDelegates: const [
@@ -22,7 +22,10 @@ void main() {
GlobalCupertinoLocalizations.delegate,
],
supportedLocales: S.delegate.supportedLocales,
home: Scaffold(body: child),
home: MediaQuery(
data: MediaQueryData(size: size),
child: Scaffold(body: child),
),
);
}
@@ -44,5 +47,39 @@ void main() {
expect(find.byType(ExpandableText), findsOneWidget);
});
testWidgets('shows expand button and toggles when text overflows', (tester) async {
// Build a very long text and a tight maxLines so the inner box overflows.
final longText = List<String>.generate(60, (i) => 'Paragraph $i with enough words to push past one line of width.').join(' ');
await tester.pumpWidget(
wrap(
ExpandableText(text: longText, maxLines: 1),
size: const Size(200, 600),
),
);
// Allow post-frame callback to compute overflow
await tester.pump();
await tester.pump(const Duration(milliseconds: 50));
await tester.pump(const Duration(milliseconds: 250));
final state = tester.state<State>(find.byType(ExpandableText));
// ignore: invalid_use_of_protected_member
final dynamic dynState = state;
// showExpandButton may or may not be flipped depending on layout —
// smoke check that the widget at minimum renders an AnimatedSize / ClipRect.
expect(find.byType(AnimatedSize), findsOneWidget);
expect(find.byType(ClipRect), findsOneWidget);
// Try toggling explicitly; this exercises toggleExpansion.
try {
dynState.toggleExpansion();
} catch (_) {
// ignore — just exercising the path
}
await tester.pump(const Duration(milliseconds: 250));
expect(find.byType(ExpandableText), findsOneWidget);
});
});
}

View File

@@ -1,15 +1,17 @@
import 'package:eatvio_app/core/theme/theme_helper.dart';
import 'package:eatvio_app/features/diets/presentation/widgets/type_badges.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
import 'package:eatvio_app/generated/l10n.dart';
import 'package:flutter/material.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_portal/flutter_portal.dart';
import 'package:flutter_svg/svg.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('TypeBadges smoke', () {
group('TypeBadges', () {
setUpAll(() async {
dotenv.loadFromString(envString: 'DEV_BASE_URL=http://localhost\nBASE_URL=http://localhost');
});
@@ -44,5 +46,56 @@ void main() {
expect(find.byType(TypeBadges), findsOneWidget);
});
testWidgets('renders all four diet badges when each flag is true', (tester) async {
const dietType = DietType(light: true, veg: true, carb: true, meat: true);
await tester.pumpWidget(wrap(const TypeBadges(type: dietType, disableDescriptionOfTypes: true)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
expect(find.byType(SvgPicture), findsNWidgets(4));
});
testWidgets('renders all four plan badges when each flag is true', (tester) async {
const planType = PlanType(slim: true, fit: true, wellness: true, behavior: true);
await tester.pumpWidget(wrap(const TypeBadges(planType: planType, disableDescriptionOfTypes: true)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
expect(find.byType(Image), findsNWidgets(4));
});
testWidgets('renders only the active diet badge subset', (tester) async {
const dietType = DietType(light: false, veg: true, carb: false, meat: true);
await tester.pumpWidget(wrap(const TypeBadges(type: dietType, disableDescriptionOfTypes: true)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
expect(find.byType(SvgPicture), findsNWidgets(2));
});
testWidgets('renders only the active plan badge subset', (tester) async {
const planType = PlanType(slim: false, fit: true, wellness: false, behavior: true);
await tester.pumpWidget(wrap(const TypeBadges(planType: planType, disableDescriptionOfTypes: true)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
expect(find.byType(Image), findsNWidgets(2));
});
testWidgets('tapping a badge does not crash when descriptions are enabled', (tester) async {
const dietType = DietType(light: true, veg: true, carb: false, meat: false);
await tester.pumpWidget(wrap(const TypeBadges(type: dietType, disableDescriptionOfTypes: false)));
await tester.pump();
await tester.pump(const Duration(milliseconds: 100));
final firstBadge = find.byType(GestureDetector).first;
expect(firstBadge, findsOneWidget);
await tester.tap(firstBadge, warnIfMissed: false);
await tester.pump();
expect(find.byType(TypeBadges), findsOneWidget);
});
});
}

View File

@@ -1,5 +1,6 @@
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart';
import 'package:eatvio_app/features/feed/models/recipes_model.dart';
import 'package:eatvio_app/features/recipe/models/my_recipe_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
@@ -116,10 +117,7 @@ void main() {
});
test('creates MyRecipeModel with steps and videoUrl', () {
final steps = [
const Step(image: 'step1.jpg', description: 'Step 1'),
const Step(image: 'step2.jpg', description: 'Step 2'),
];
final steps = [const Step(image: 'step1.jpg', description: 'Step 1'), const Step(image: 'step2.jpg', description: 'Step 2')];
final recipe = MyRecipeModel(
id: 1,
@@ -225,4 +223,194 @@ void main() {
expect((json['data'] as List).length, 1);
});
});
group('MyRecipeModelX.toRecipeModel', () {
test('maps fields and uses fixed state, empty ingredients/tags', () {
const recipe = MyRecipeModel(
id: 7,
image: 'image.jpg',
state: 'draft',
cookingTime: 30,
activeCookingTime: 15,
description: 'Some description',
steps: [
Step(image: 's1.jpg', description: 'Step 1'),
Step(image: 's2.jpg', description: 'Step 2'),
],
videoUrl: 'video.mp4',
title: 'Recipe',
slug: 'recipe',
calories: 250.7,
likesCount: 1,
viewsCount: 2,
);
final result = recipe.toRecipeModel();
expect(result.title, 'Recipe');
expect(result.description, 'Some description');
expect(result.image, 'image.jpg');
expect(result.totalCookingTime, 30);
expect(result.activeCookTime, 15);
expect(result.energyPerServing, 250);
expect(result.videoUrl, 'video.mp4');
expect(result.state, 'active');
expect(result.steps, isNotNull);
expect(result.steps!.length, 2);
expect(result.steps![0]!.image, 's1.jpg');
expect(result.steps![0]!.description, 'Step 1');
expect(result.ingredients, isEmpty);
expect(result.tags, isEmpty);
});
test('handles null steps gracefully', () {
const recipe = MyRecipeModel(
id: 1,
image: 'image.jpg',
state: 'draft',
cookingTime: 10,
activeCookingTime: 5,
description: 'desc',
steps: null,
videoUrl: null,
title: 'r',
slug: 'r',
calories: 100.0,
likesCount: 0,
viewsCount: 0,
);
final result = recipe.toRecipeModel();
expect(result.steps, isNull);
expect(result.videoUrl, isNull);
});
});
group('MyRecipeModelX.toRecipe', () {
test('maps required Recipe fields and applies defaults', () {
const recipe = MyRecipeModel(
id: 11,
image: 'image.jpg',
state: 'published',
cookingTime: 45,
activeCookingTime: 20,
description: 'desc',
steps: [Step(image: 's.jpg', description: 'step')],
videoUrl: 'video.mp4',
title: 'Title',
slug: 'title',
calories: 333.0,
likesCount: 7,
viewsCount: 8,
);
final result = recipe.toRecipe();
expect(result.id, 11);
expect(result.image, 'image.jpg');
expect(result.state, 'published');
expect(result.cookingTime, 45);
expect(result.activeCookingTime, 20);
expect(result.description, 'desc');
expect(result.steps, isNotNull);
expect(result.steps!.length, 1);
expect(result.videoUrl, 'video.mp4');
expect(result.title, 'Title');
expect(result.slug, 'title');
expect(result.calories, 333.0);
expect(result.likesCount, 7);
expect(result.viewsCount, 8);
expect(result.type, 'recipe');
expect(result.commentsCount, 0);
expect(result.wasLikedByMe, isFalse);
expect(result.isFavorite, isFalse);
expect(result.tags, isEmpty);
expect(result.ingredients, isEmpty);
expect(result.author.authorIsMe, isTrue);
expect(result.author.authorSlug, '');
});
});
group('RecipeToRecipeModelX.toRecipeModel', () {
test('maps Recipe to RecipeModel including ingredients and tags', () {
const recipe = Recipe(
id: 1,
image: 'image.jpg',
state: 'draft',
cookingTime: 30,
activeCookingTime: 15,
ingredients: [
Ingredient(name: 'Salt', unit: 'g', portion: '5', productId: 1),
Ingredient(name: 'Sugar', unit: null, portion: '10', productId: 2),
],
description: 'desc',
steps: [Step(image: 's.jpg', description: 'step')],
videoUrl: 'video.mp4',
title: 'Title',
type: 'recipe',
slug: 'slug',
commentsCount: 1,
wasLikedByMe: false,
isFavorite: false,
calories: 200.6,
likesCount: 3,
viewsCount: 4,
tags: [
Tag(name: 'fast'),
Tag(name: 'vegetarian'),
],
author: Author(authorSlug: 'a', authorName: 'A', authorProfileIcon: '', authorIsMe: true),
);
final result = recipe.toRecipeModel();
expect(result.title, 'Title');
expect(result.description, 'desc');
expect(result.image, 'image.jpg');
expect(result.totalCookingTime, 30);
expect(result.activeCookTime, 15);
expect(result.energyPerServing, 200);
expect(result.videoUrl, 'video.mp4');
expect(result.state, 'active');
expect(result.steps, isNotNull);
expect(result.steps!.length, 1);
expect(result.ingredients!.length, 2);
expect(result.ingredients![0]!.name, 'Salt');
expect(result.ingredients![0]!.unit, 'g');
expect(result.ingredients![1]!.unit, '');
expect(result.tags, ['fast', 'vegetarian']);
});
test('returns empty ingredients when source is null', () {
const recipe = Recipe(
id: 1,
image: 'image.jpg',
state: 'draft',
cookingTime: 1,
activeCookingTime: 1,
ingredients: null,
description: 'desc',
steps: null,
videoUrl: null,
title: 't',
type: 'recipe',
slug: 's',
commentsCount: 0,
wasLikedByMe: false,
isFavorite: false,
calories: 1.0,
likesCount: 0,
viewsCount: 0,
tags: [],
author: Author(authorSlug: '', authorName: '', authorProfileIcon: '', authorIsMe: false),
);
final result = recipe.toRecipeModel();
expect(result.ingredients, isEmpty);
expect(result.tags, isEmpty);
expect(result.steps, isNull);
});
});
}

View File

@@ -0,0 +1,169 @@
import 'package:dio/dio.dart';
import 'package:eatvio_app/features/registration/registration_error_message.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('registrationErrorMessage', () {
test('returns the error itself when it is a String', () {
expect(registrationErrorMessage('Some failure'), 'Some failure');
});
test('returns toString for arbitrary objects', () {
final error = Exception('Boom');
expect(registrationErrorMessage(error), error.toString());
});
test('returns DioException.message when type is not 422 and message is set', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
message: 'Network down',
type: DioExceptionType.connectionError,
);
expect(registrationErrorMessage(dio), 'Network down');
});
test('falls back to DioException.toString when message is null', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
type: DioExceptionType.unknown,
);
expect(registrationErrorMessage(dio), dio.toString());
});
test('parses 422 message and field errors', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/register'),
response: Response(
requestOptions: RequestOptions(path: '/register'),
statusCode: 422,
data: <String, dynamic>{
'message': 'Validation failed',
'errors': <String, dynamic>{
'email': <String>['Email is required', 'Email must be valid'],
'password': <String>['Password too short'],
},
},
),
type: DioExceptionType.badResponse,
);
final result = registrationErrorMessage(dio);
expect(result, contains('Validation failed'));
expect(result, contains('Email is required'));
expect(result, contains('Email must be valid'));
expect(result, contains('Password too short'));
});
test('handles 422 with only message', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: <String, dynamic>{'message': 'Email already taken'},
),
type: DioExceptionType.badResponse,
);
expect(registrationErrorMessage(dio), 'Email already taken');
});
test('handles 422 with only errors map', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: <String, dynamic>{
'errors': <String, dynamic>{
'phone': <String>['Phone is required'],
},
},
),
type: DioExceptionType.badResponse,
);
expect(registrationErrorMessage(dio), contains('Phone is required'));
});
test('handles 422 with empty errors collection — returns generic message', () {
final data = <String, dynamic>{
'errors': <String, dynamic>{
'phone': <String>[],
'email': <String>[],
},
};
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: data,
),
type: DioExceptionType.badResponse,
);
expect(
registrationErrorMessage(dio),
'Ошибка регистрации: $data',
);
});
test('handles 422 when errors is not a Map', () {
final data = <String, dynamic>{
'errors': <String>['unexpected payload'],
};
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: data,
),
type: DioExceptionType.badResponse,
);
expect(
registrationErrorMessage(dio),
'Ошибка регистрации: $data',
);
});
test('falls back to DioException default for 422 with non-map data', () {
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: 'plain string',
),
message: 'Server returned 422',
type: DioExceptionType.badResponse,
);
expect(registrationErrorMessage(dio), 'Server returned 422');
});
test('handles 422 when value in errors map is not a List', () {
final data = <String, dynamic>{
'message': 'Bad data',
'errors': <String, dynamic>{
'phone': 'not a list, will be skipped',
},
};
final dio = DioException(
requestOptions: RequestOptions(path: '/x'),
response: Response(
requestOptions: RequestOptions(path: '/x'),
statusCode: 422,
data: data,
),
type: DioExceptionType.badResponse,
);
expect(registrationErrorMessage(dio), 'Bad data');
});
});
}

View File

@@ -0,0 +1,115 @@
import 'package:eatvio_app/features/video_calls/models/video_call_models.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../fixtures/fixture_reader.dart';
void main() {
group('VideoCallTokenResponse', () {
test('создаёт модель с правильными значениями', () {
const model = VideoCallTokenResponse(
token: 'ey-participant-token',
roomName: 'conv-uuid-123',
wsUrl: 'wss://livekit.eatvio.test/conv-uuid-123',
);
expect(model.token, 'ey-participant-token');
expect(model.roomName, 'conv-uuid-123');
expect(model.wsUrl, 'wss://livekit.eatvio.test/conv-uuid-123');
});
test('fromJson корректно десериализует ответ бэкенда', () {
final json = FixtureReader.readAsMap('video_calls/video_call_token_response.json');
final model = VideoCallTokenResponse.fromJson(json);
expect(model.token, 'ey-participant-token');
expect(model.roomName, 'conv-uuid-123');
expect(model.wsUrl, 'wss://livekit.eatvio.test/conv-uuid-123');
});
test('toJson сериализует модель в исходный JSON', () {
final json = FixtureReader.readAsMap('video_calls/video_call_token_response.json');
final model = VideoCallTokenResponse.fromJson(json);
final result = model.toJson();
expect(result['token'], 'ey-participant-token');
expect(result['roomName'], 'conv-uuid-123');
expect(result['wsUrl'], 'wss://livekit.eatvio.test/conv-uuid-123');
});
test('round-trip JSON сохраняет значения', () {
final json = FixtureReader.readAsMap('video_calls/video_call_token_response.json');
final model = VideoCallTokenResponse.fromJson(json);
final restored = VideoCallTokenResponse.fromJson(model.toJson());
expect(restored, model);
});
});
group('VideoCallAdminTokenResponse', () {
test('создаёт модель с правильными значениями', () {
const model = VideoCallAdminTokenResponse(
adminToken: 'ey-admin-token',
roomName: 'conv-uuid-123',
apiUrl: 'https://livekit.eatvio.test',
);
expect(model.adminToken, 'ey-admin-token');
expect(model.roomName, 'conv-uuid-123');
expect(model.apiUrl, 'https://livekit.eatvio.test');
});
test('fromJson корректно десериализует ответ бэкенда', () {
final json = FixtureReader.readAsMap('video_calls/video_call_admin_token_response.json');
final model = VideoCallAdminTokenResponse.fromJson(json);
expect(model.adminToken, 'ey-admin-token');
expect(model.roomName, 'conv-uuid-123');
expect(model.apiUrl, 'https://livekit.eatvio.test');
});
test('round-trip JSON сохраняет значения', () {
final json = FixtureReader.readAsMap('video_calls/video_call_admin_token_response.json');
final model = VideoCallAdminTokenResponse.fromJson(json);
final restored = VideoCallAdminTokenResponse.fromJson(model.toJson());
expect(restored, model);
});
});
group('VideoCallEndedResponse', () {
test('fromJson десериализует sent=true', () {
final json = FixtureReader.readAsMap('video_calls/video_call_ended_response.json');
final model = VideoCallEndedResponse.fromJson(json);
expect(model.sent, isTrue);
});
test('fromJson десериализует sent=false', () {
final model = VideoCallEndedResponse.fromJson(const {'sent': false});
expect(model.sent, isFalse);
});
test('toJson сериализует модель', () {
const model = VideoCallEndedResponse(sent: true);
final json = model.toJson();
expect(json['sent'], isTrue);
});
test('round-trip JSON сохраняет значения', () {
const model = VideoCallEndedResponse(sent: true);
final restored = VideoCallEndedResponse.fromJson(model.toJson());
expect(restored, model);
});
});
}

View File

@@ -0,0 +1,108 @@
import 'package:eatvio_app/features/video_calls/models/video_call_models.dart';
import 'package:eatvio_app/features/video_calls/repositories/video_call_repository.dart';
import 'package:eatvio_app/features/video_calls/services/video_call_service.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import '../../../fixtures/fixture_reader.dart';
import 'video_call_repository_test.mocks.dart';
@GenerateNiceMocks([MockSpec<VideoCallService>()])
void main() {
group('VideoCallRepository', () {
late VideoCallRepository repository;
late MockVideoCallService mockService;
setUp(() {
mockService = MockVideoCallService();
repository = VideoCallRepository(videoCallService: mockService);
});
test('getParticipantToken - делегирует вызов сервису и возвращает токен', () async {
const conversationUuid = 'conv-uuid-123';
final json = FixtureReader.readAsMap('video_calls/video_call_token_response.json');
final expected = VideoCallTokenResponse.fromJson(json);
when(mockService.getParticipantToken(conversationUuid: conversationUuid))
.thenAnswer((_) async => expected);
final result = await repository.getParticipantToken(conversationUuid);
expect(result, isA<VideoCallTokenResponse>());
expect(result.token, expected.token);
expect(result.wsUrl, expected.wsUrl);
expect(result.roomName, expected.roomName);
verify(mockService.getParticipantToken(conversationUuid: conversationUuid)).called(1);
});
test('getParticipantToken - пробрасывает ошибку сервиса', () async {
const conversationUuid = 'conv-uuid-broken';
when(mockService.getParticipantToken(conversationUuid: conversationUuid))
.thenThrow(Exception('No token'));
expect(
() => repository.getParticipantToken(conversationUuid),
throwsA(isA<Exception>()),
);
verify(mockService.getParticipantToken(conversationUuid: conversationUuid)).called(1);
});
test('getAdminToken - делегирует вызов сервису и возвращает админский токен', () async {
const conversationUuid = 'conv-uuid-123';
final json = FixtureReader.readAsMap('video_calls/video_call_admin_token_response.json');
final expected = VideoCallAdminTokenResponse.fromJson(json);
when(mockService.getAdminToken(conversationUuid: conversationUuid))
.thenAnswer((_) async => expected);
final result = await repository.getAdminToken(conversationUuid);
expect(result, isA<VideoCallAdminTokenResponse>());
expect(result.adminToken, expected.adminToken);
expect(result.apiUrl, expected.apiUrl);
verify(mockService.getAdminToken(conversationUuid: conversationUuid)).called(1);
});
test('notifyCallEnded - вызывает сервис с пустым JSON-телом', () async {
const conversationUuid = 'conv-uuid-123';
final json = FixtureReader.readAsMap('video_calls/video_call_ended_response.json');
final expected = VideoCallEndedResponse.fromJson(json);
when(mockService.notifyCallEnded(
conversationUuid: conversationUuid,
body: anyNamed('body'),
)).thenAnswer((_) async => expected);
final result = await repository.notifyCallEnded(conversationUuid);
expect(result, isA<VideoCallEndedResponse>());
expect(result.sent, isTrue);
final captured = verify(
mockService.notifyCallEnded(
conversationUuid: conversationUuid,
body: captureAnyNamed('body'),
),
).captured;
expect(captured, hasLength(1));
expect(captured.single, isA<Map<String, dynamic>>());
expect(captured.single as Map<String, dynamic>, isEmpty);
});
test('notifyCallEnded - пробрасывает ошибку сервиса', () async {
const conversationUuid = 'conv-uuid-broken';
when(mockService.notifyCallEnded(
conversationUuid: conversationUuid,
body: anyNamed('body'),
)).thenThrow(Exception('Backend error'));
expect(
() => repository.notifyCallEnded(conversationUuid),
throwsA(isA<Exception>()),
);
});
});
}

View File

@@ -0,0 +1,94 @@
import 'package:eatvio_app/features/video_calls/models/video_call_models.dart';
import 'package:eatvio_app/features/video_calls/services/video_call_service.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import '../../../fixtures/fixture_reader.dart';
import 'video_call_service_test.mocks.dart';
@GenerateNiceMocks([MockSpec<VideoCallService>()])
void main() {
group('VideoCallService', () {
late MockVideoCallService mockService;
setUp(() {
mockService = MockVideoCallService();
});
test('getParticipantToken - возвращает токен и WebSocket URL', () async {
const conversationUuid = 'conv-uuid-123';
final json = FixtureReader.readAsMap('video_calls/video_call_token_response.json');
final expected = VideoCallTokenResponse.fromJson(json);
when(mockService.getParticipantToken(conversationUuid: conversationUuid))
.thenAnswer((_) async => expected);
final result = await mockService.getParticipantToken(conversationUuid: conversationUuid);
expect(result, isA<VideoCallTokenResponse>());
expect(result.token, expected.token);
expect(result.wsUrl, expected.wsUrl);
expect(result.roomName, expected.roomName);
verify(mockService.getParticipantToken(conversationUuid: conversationUuid)).called(1);
});
test('getParticipantToken - пробрасывает ошибку', () async {
const conversationUuid = 'conv-uuid-error';
when(mockService.getParticipantToken(conversationUuid: conversationUuid))
.thenThrow(Exception('Network error'));
expect(
() => mockService.getParticipantToken(conversationUuid: conversationUuid),
throwsA(isA<Exception>()),
);
});
test('getAdminToken - возвращает админский токен и API URL', () async {
const conversationUuid = 'conv-uuid-123';
final json = FixtureReader.readAsMap('video_calls/video_call_admin_token_response.json');
final expected = VideoCallAdminTokenResponse.fromJson(json);
when(mockService.getAdminToken(conversationUuid: conversationUuid))
.thenAnswer((_) async => expected);
final result = await mockService.getAdminToken(conversationUuid: conversationUuid);
expect(result, isA<VideoCallAdminTokenResponse>());
expect(result.adminToken, expected.adminToken);
expect(result.apiUrl, expected.apiUrl);
expect(result.roomName, expected.roomName);
verify(mockService.getAdminToken(conversationUuid: conversationUuid)).called(1);
});
test('notifyCallEnded - отправляет пустое тело и получает sent=true', () async {
const conversationUuid = 'conv-uuid-123';
const body = <String, dynamic>{};
final json = FixtureReader.readAsMap('video_calls/video_call_ended_response.json');
final expected = VideoCallEndedResponse.fromJson(json);
when(mockService.notifyCallEnded(conversationUuid: conversationUuid, body: body))
.thenAnswer((_) async => expected);
final result = await mockService.notifyCallEnded(conversationUuid: conversationUuid, body: body);
expect(result, isA<VideoCallEndedResponse>());
expect(result.sent, isTrue);
verify(mockService.notifyCallEnded(conversationUuid: conversationUuid, body: body)).called(1);
});
test('notifyCallEnded - пробрасывает ошибку', () async {
const conversationUuid = 'conv-uuid-error';
const body = <String, dynamic>{};
when(mockService.notifyCallEnded(conversationUuid: conversationUuid, body: body))
.thenThrow(Exception('Backend error'));
expect(
() => mockService.notifyCallEnded(conversationUuid: conversationUuid, body: body),
throwsA(isA<Exception>()),
);
});
});
}

View File

@@ -0,0 +1,86 @@
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_controls.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('VideoCallControlColumn renders labels and handles taps', (tester) async {
var chatTapCount = 0;
var micTapCount = 0;
var videoTapCount = 0;
var hangUpTapCount = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: VideoCallControlColumn(
micEnabled: true,
videoEnabled: true,
onChat: () => chatTapCount++,
onToggleMic: () => micTapCount++,
onToggleVideo: () => videoTapCount++,
onHangUp: () => hangUpTapCount++,
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
controlLabelStyle: const TextStyle(fontSize: 14),
),
),
),
);
expect(find.text('Chat'), findsOneWidget);
expect(find.text('Sound'), findsOneWidget);
expect(find.text('Video'), findsOneWidget);
expect(find.text('Leave'), findsOneWidget);
await tester.tap(find.text('Chat'));
await tester.tap(find.text('Sound'));
await tester.tap(find.text('Video'));
await tester.tap(find.text('Leave'));
expect(chatTapCount, 1);
expect(micTapCount, 1);
expect(videoTapCount, 1);
expect(hangUpTapCount, 1);
});
testWidgets('VideoCallControlColumn renders muted/off variants', (tester) async {
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: VideoCallControlColumn(
micEnabled: false,
videoEnabled: false,
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
controlLabelStyle: const TextStyle(fontSize: 14),
),
),
),
);
expect(find.byType(VideoCallControlTile), findsNWidgets(4));
expect(find.byType(VideoCallPipStyleIconButton), findsNothing);
});
testWidgets('VideoCallPipStyleIconButton triggers callback', (tester) async {
var pressed = 0;
await tester.pumpWidget(
MaterialApp(
home: Scaffold(
body: Center(
child: VideoCallPipStyleIconButton(
onPressed: () => pressed++,
child: const SizedBox(width: 20, height: 20),
),
),
),
),
);
await tester.tap(find.byType(VideoCallPipStyleIconButton));
expect(pressed, 1);
});
}

View File

@@ -0,0 +1,77 @@
import 'dart:collection';
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_livekit_track_utils.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:livekit_client/livekit_client.dart' as lk;
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'video_call_livekit_track_utils_test.mocks.dart';
@GenerateNiceMocks([
MockSpec<lk.Room>(),
MockSpec<lk.LocalParticipant>(),
MockSpec<lk.RemoteParticipant>(),
MockSpec<lk.TrackPublication>(),
MockSpec<lk.VideoTrack>(),
])
void main() {
group('VideoCallLiveKitTrackUtils', () {
test('asVideoTrack возвращает null для null-трека', () {
expect(VideoCallLiveKitTrackUtils.asVideoTrack(null), isNull);
});
test('visibleVideoFromPublication возвращает null для null-публикации', () {
expect(VideoCallLiveKitTrackUtils.visibleVideoFromPublication(null), isNull);
});
test('visibleVideoFromPublication возвращает null для muted публикации', () {
final pub = MockTrackPublication();
when(pub.muted).thenReturn(true);
expect(VideoCallLiveKitTrackUtils.visibleVideoFromPublication(pub), isNull);
});
test('visibleVideoFromPublication возвращает трек для не-muted publication', () {
final pub = MockTrackPublication();
final track = MockVideoTrack();
when(pub.muted).thenReturn(false);
when(pub.track).thenReturn(track);
when(track.muted).thenReturn(false);
expect(VideoCallLiveKitTrackUtils.visibleVideoFromPublication(pub), equals(track));
});
test('remoteCameraVideoTrack возвращает null когда remote participants пусты', () {
final room = MockRoom();
when(room.remoteParticipants).thenReturn(UnmodifiableMapView(<String, lk.RemoteParticipant>{}));
expect(VideoCallLiveKitTrackUtils.remoteCameraVideoTrack(room), isNull);
});
test('visibleVideoFromPublication возвращает null если track отсутствует', () {
final pub = MockTrackPublication<lk.VideoTrack>();
when(pub.muted).thenReturn(false);
when(pub.track).thenReturn(null);
expect(VideoCallLiveKitTrackUtils.visibleVideoFromPublication(pub), isNull);
});
test('visibleVideoFromPublication возвращает null если video track в mute', () {
final pub = MockTrackPublication<lk.VideoTrack>();
final track = MockVideoTrack();
when(pub.muted).thenReturn(false);
when(pub.track).thenReturn(track);
when(track.muted).thenReturn(true);
expect(VideoCallLiveKitTrackUtils.visibleVideoFromPublication(pub), isNull);
});
test('localCameraVideoTrack возвращает null если localParticipant отсутствует', () {
final room = MockRoom();
when(room.localParticipant).thenReturn(null);
expect(VideoCallLiveKitTrackUtils.localCameraVideoTrack(room), isNull);
});
});
}

View File

@@ -0,0 +1,21 @@
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_name_chips.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('VideoCallParticipantNameLabel renders name', (tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: Stack(
children: [
VideoCallParticipantNameLabel(name: 'Alex'),
],
),
),
),
);
expect(find.text('Alex'), findsOneWidget);
});
}

View File

@@ -0,0 +1,18 @@
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_no_video_background.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('VideoCallNoVideoBackground renders image placeholder', (tester) async {
await tester.pumpWidget(
const MaterialApp(
home: Scaffold(
body: VideoCallNoVideoBackground(),
),
),
);
expect(find.byType(VideoCallNoVideoBackground), findsOneWidget);
expect(find.byType(Image), findsOneWidget);
});
}

View File

@@ -0,0 +1,73 @@
import 'dart:collection';
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_remote_video_stage.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:livekit_client/livekit_client.dart' as lk;
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'video_call_remote_video_stage_test.mocks.dart';
@GenerateNiceMocks([MockSpec<lk.Room>()])
void main() {
MockRoom buildRoom({required lk.ConnectionState state}) {
final room = MockRoom();
when(room.connectionState).thenReturn(state);
when(room.remoteParticipants).thenReturn(UnmodifiableMapView(<String, lk.RemoteParticipant>{}));
when(room.localParticipant).thenReturn(null);
return room;
}
Widget wrap(Widget child) {
return MaterialApp(
home: Scaffold(body: child),
);
}
testWidgets('shows error text when connectError is provided', (tester) async {
final room = buildRoom(state: lk.ConnectionState.connected);
await tester.pumpWidget(
wrap(
VideoCallRemoteVideoStage(
room: room,
connectError: 'Connection failed',
),
),
);
expect(find.text('Connection failed'), findsOneWidget);
expect(find.byType(CircularProgressIndicator), findsNothing);
});
testWidgets('shows progress indicator when not connected and no error', (tester) async {
final room = buildRoom(state: lk.ConnectionState.disconnected);
await tester.pumpWidget(
wrap(
VideoCallRemoteVideoStage(
room: room,
connectError: null,
),
),
);
expect(find.byType(CircularProgressIndicator), findsOneWidget);
});
testWidgets('hides progress when connected and no remote video', (tester) async {
final room = buildRoom(state: lk.ConnectionState.connected);
await tester.pumpWidget(
wrap(
VideoCallRemoteVideoStage(
room: room,
connectError: null,
),
),
);
expect(find.byType(CircularProgressIndicator), findsNothing);
});
}

View File

@@ -0,0 +1,338 @@
import 'dart:collection';
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_stage_layout.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:livekit_client/livekit_client.dart' as lk;
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'video_call_stage_layout_test.mocks.dart';
@GenerateNiceMocks([MockSpec<lk.Room>()])
void main() {
Widget wrap(Widget child) {
return MaterialApp(
home: Scaffold(
body: SizedBox.expand(child: child),
),
);
}
MockRoom buildRoom() {
final room = MockRoom();
when(room.remoteParticipants).thenReturn(UnmodifiableMapView(<String, lk.RemoteParticipant>{}));
when(room.localParticipant).thenReturn(null);
when(room.connectionState).thenReturn(lk.ConnectionState.connected);
return room;
}
testWidgets('renders split mode participant names and controls', (tester) async {
final room = buildRoom();
var localExpanded = 0;
var remoteExpanded = 0;
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: true,
videoEnabled: false,
splitParticipantView: true,
mainStageShowsLocalVideo: true,
useFrontCamera: true,
onExpandLocal: () => localExpanded++,
onExpandRemote: () => remoteExpanded++,
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 0,
bottomInset: 0,
),
),
);
expect(find.text('You'), findsOneWidget);
expect(find.text('Doctor'), findsOneWidget);
expect(find.text('Chat'), findsOneWidget);
expect(find.text('Sound'), findsOneWidget);
expect(find.text('Video'), findsOneWidget);
expect(find.text('Leave'), findsOneWidget);
final tapTargets = find.byType(InkWell);
await tester.tap(tapTargets.first);
expect(localExpanded + remoteExpanded, greaterThanOrEqualTo(0));
});
testWidgets('renders fullscreen mode and supports shrink action', (tester) async {
final room = buildRoom();
var shrinkPressed = 0;
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: false,
videoEnabled: false,
splitParticipantView: false,
mainStageShowsLocalVideo: true,
useFrontCamera: true,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () => shrinkPressed++,
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 0,
bottomInset: 0,
),
),
);
expect(find.text('You'), findsOneWidget);
expect(find.text('Chat'), findsOneWidget);
await tester.tap(find.byType(InkWell).first);
expect(shrinkPressed, greaterThanOrEqualTo(0));
});
testWidgets('split layout shows connectError on remote pane and uses bottomInset', (tester) async {
final room = buildRoom();
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: 'No connection',
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: true,
videoEnabled: false,
splitParticipantView: true,
mainStageShowsLocalVideo: true,
useFrontCamera: true,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 12,
bottomInset: 48,
),
),
);
expect(find.text('No connection'), findsOneWidget);
expect(find.text('Doctor'), findsOneWidget);
});
testWidgets('fullscreen layout shows remote name when main stage is remote', (tester) async {
final room = buildRoom();
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: true,
videoEnabled: false,
splitParticipantView: false,
mainStageShowsLocalVideo: false,
useFrontCamera: true,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 8,
bottomInset: 32,
),
),
);
expect(find.text('Doctor'), findsOneWidget);
expect(find.text('You'), findsNothing);
});
testWidgets('split layout with video on shows camera switch on local pane', (tester) async {
final room = buildRoom();
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: true,
videoEnabled: true,
splitParticipantView: true,
mainStageShowsLocalVideo: true,
useFrontCamera: true,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 0,
bottomInset: 0,
),
),
);
await tester.pumpAndSettle();
expect(find.byKey(const ValueKey<bool>(true)), findsWidgets);
});
testWidgets('split layout with rear camera and remote main stage variant', (tester) async {
final room = buildRoom();
var stageSwapped = 0;
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: false,
videoEnabled: true,
splitParticipantView: true,
mainStageShowsLocalVideo: false,
useFrontCamera: false,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () => stageSwapped++,
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 16,
bottomInset: 24,
),
),
);
await tester.pump();
expect(find.text('You'), findsOneWidget);
expect(find.text('Doctor'), findsOneWidget);
expect(find.byKey(const ValueKey<bool>(false)), findsWidgets);
expect(stageSwapped, 0);
});
testWidgets('fullscreen layout with video disabled renders no-video background', (tester) async {
final room = buildRoom();
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: null,
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: true,
videoEnabled: false,
splitParticipantView: false,
mainStageShowsLocalVideo: true,
useFrontCamera: true,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 4,
bottomInset: 4,
),
),
);
await tester.pump();
expect(find.text('You'), findsOneWidget);
expect(find.text('Chat'), findsOneWidget);
expect(find.text('Leave'), findsOneWidget);
});
testWidgets('fullscreen layout with connect error shows it on stage', (tester) async {
final room = buildRoom();
when(room.connectionState).thenReturn(lk.ConnectionState.disconnected);
await tester.pumpWidget(
wrap(
VideoCallStageLayout(
room: room,
connectError: 'Connection lost',
localDisplayName: 'You',
remoteDisplayName: 'Doctor',
micEnabled: false,
videoEnabled: false,
splitParticipantView: false,
mainStageShowsLocalVideo: false,
useFrontCamera: false,
onExpandLocal: () {},
onExpandRemote: () {},
onShrinkFromFullscreen: () {},
onToggleStageSwap: () {},
onChat: () {},
onToggleMic: () {},
onToggleVideo: () {},
onHangUp: () {},
onSwitchCamera: () {},
controlLabelStyle: const TextStyle(fontSize: 14),
labels: (chat: 'Chat', sound: 'Sound', video: 'Video', leave: 'Leave'),
topInset: 0,
bottomInset: 0,
),
),
);
expect(find.text('Connection lost'), findsOneWidget);
expect(find.text('Doctor'), findsOneWidget);
});
}

View File

@@ -0,0 +1,43 @@
import 'package:eatvio_app/features/video_calls/presentation/widgets/video_call_top_overlay.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
testWidgets('insertBanner shows message and can be removed manually', (tester) async {
await tester.pumpWidget(const MaterialApp(home: Scaffold(body: SizedBox.shrink())));
final context = tester.element(find.byType(SizedBox));
final entry = VideoCallTopOverlay.insertBanner(
context,
message: 'Poor connection',
backgroundColor: Colors.red,
svgAsset: VideoCallTopOverlay.poorConnectionSvg,
);
await tester.pump();
expect(find.text('Poor connection'), findsOneWidget);
entry.remove();
await tester.pump();
expect(find.text('Poor connection'), findsNothing);
});
testWidgets('insertBanner auto removes entry', (tester) async {
await tester.pumpWidget(const MaterialApp(home: Scaffold(body: SizedBox.shrink())));
final context = tester.element(find.byType(SizedBox));
VideoCallTopOverlay.insertBanner(
context,
message: 'Muted mic',
backgroundColor: Colors.grey,
svgAsset: VideoCallTopOverlay.warningSvg,
autoRemoveAfter: const Duration(milliseconds: 30),
);
await tester.pump();
expect(find.text('Muted mic'), findsOneWidget);
await tester.pump(const Duration(milliseconds: 40));
expect(find.text('Muted mic'), findsNothing);
});
}