forked from eatvio/eatvio_app
108 lines
3.4 KiB
Dart
108 lines
3.4 KiB
Dart
import 'package:eatvio_app/features/settings/entities/settings_entity.dart';
|
|
import 'package:eatvio_app/features/settings/models/profile_settings_model.dart';
|
|
import 'package:eatvio_app/features/profile/models/profile_model.dart';
|
|
import 'package:eatvio_app/features/settings/presentation/bloc/settings_cubit/settings_cubit.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mockito/mockito.dart';
|
|
|
|
class MockSettingsCubit extends Mock implements SettingsCubit {}
|
|
|
|
void main() {
|
|
group('SettingsEntity', () {
|
|
test('creates SettingsEntity with all parameters', () {
|
|
final mockCubit = MockSettingsCubit();
|
|
const profileSettings = ProfileSettingsModel(
|
|
newUpdatesNotifications: true,
|
|
diaryReminderNotifications: true,
|
|
isMoodFillable: true,
|
|
isBedtimeFillable: true,
|
|
isPublicProfile: true,
|
|
);
|
|
const profileDetails = ProfileDetailsModel(
|
|
firstName: 'John',
|
|
lastName: 'Doe',
|
|
birthdate: '1990-01-01',
|
|
gender: 'male',
|
|
country: 'Russia',
|
|
city: 'Moscow',
|
|
lang: 'ru',
|
|
weight: 75.0,
|
|
height: 180,
|
|
chestCircumference: 100,
|
|
waistCircumference: 80,
|
|
hipCircumference: 90,
|
|
bloodPressureUp: 120,
|
|
bloodPressureDown: 80,
|
|
hasHypo: false,
|
|
hasHyper: false,
|
|
aboutAlergy: 'None',
|
|
aboutTakingPils: 'None',
|
|
aboutSportHobbies: 'Running',
|
|
favoriteFoods: 'Pizza',
|
|
unfavoriteFoods: 'Broccoli',
|
|
additionalInfo: 'No additional info',
|
|
isMoodFillable: true,
|
|
isBedtimeFillable: true,
|
|
activityCoefficient: 1.5,
|
|
);
|
|
|
|
final entity = SettingsEntity(
|
|
profileSettingsModel: profileSettings,
|
|
profileDetailsModel: profileDetails,
|
|
settingsCubit: mockCubit,
|
|
);
|
|
|
|
expect(entity.profileSettingsModel, profileSettings);
|
|
expect(entity.profileDetailsModel, profileDetails);
|
|
expect(entity.settingsCubit, mockCubit);
|
|
});
|
|
|
|
test('creates SettingsEntity with different values', () {
|
|
final mockCubit = MockSettingsCubit();
|
|
const profileSettings = ProfileSettingsModel(
|
|
newUpdatesNotifications: false,
|
|
diaryReminderNotifications: false,
|
|
isMoodFillable: false,
|
|
isBedtimeFillable: false,
|
|
isPublicProfile: false,
|
|
);
|
|
const profileDetails = ProfileDetailsModel(
|
|
firstName: 'Jane',
|
|
lastName: 'Smith',
|
|
birthdate: '1995-05-15',
|
|
gender: 'female',
|
|
country: 'USA',
|
|
city: 'New York',
|
|
lang: 'en',
|
|
weight: 60.0,
|
|
height: 165,
|
|
chestCircumference: 90,
|
|
waistCircumference: 70,
|
|
hipCircumference: 85,
|
|
bloodPressureUp: 110,
|
|
bloodPressureDown: 70,
|
|
hasHypo: true,
|
|
hasHyper: false,
|
|
aboutAlergy: 'Peanuts',
|
|
aboutTakingPils: 'Vitamins',
|
|
aboutSportHobbies: 'Yoga',
|
|
favoriteFoods: 'Salad',
|
|
unfavoriteFoods: 'Fast food',
|
|
additionalInfo: 'Vegetarian',
|
|
isMoodFillable: false,
|
|
isBedtimeFillable: false,
|
|
activityCoefficient: 1.2,
|
|
);
|
|
|
|
final entity = SettingsEntity(
|
|
profileSettingsModel: profileSettings,
|
|
profileDetailsModel: profileDetails,
|
|
settingsCubit: mockCubit,
|
|
);
|
|
|
|
expect(entity.profileSettingsModel.isPublicProfile, false);
|
|
expect(entity.profileDetailsModel.firstName, 'Jane');
|
|
});
|
|
});
|
|
}
|