forked from eatvio/eatvio_app
chore(dependencies): add webview_flutter_platform_interface package to pubspec.yaml and clean up test files by removing unnecessary whitespace
This commit is contained in:
@@ -1,30 +1,107 @@
|
||||
import 'package:eatvio_app/features/profile/models/profile_model.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/annotations.dart';
|
||||
import 'package:mockito/mockito.dart';
|
||||
|
||||
import 'settings_entity_test.mocks.dart';
|
||||
class MockSettingsCubit extends Mock implements SettingsCubit {}
|
||||
|
||||
@GenerateNiceMocks([MockSpec<ProfileSettingsModel>(), MockSpec<ProfileDetailsModel>(), MockSpec<SettingsCubit>()])
|
||||
void main() {
|
||||
group('SettingsEntity', () {
|
||||
test('создает SettingsEntity с правильными значениями', () {
|
||||
final mockSettings = MockProfileSettingsModel();
|
||||
final mockDetails = MockProfileDetailsModel();
|
||||
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: mockSettings,
|
||||
profileDetailsModel: mockDetails,
|
||||
profileSettingsModel: profileSettings,
|
||||
profileDetailsModel: profileDetails,
|
||||
settingsCubit: mockCubit,
|
||||
);
|
||||
|
||||
expect(entity.profileSettingsModel, mockSettings);
|
||||
expect(entity.profileDetailsModel, mockDetails);
|
||||
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');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user