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:
@@ -3,21 +3,22 @@ import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('UserRegistrationSheet', () {
|
||||
test('создает UserRegistrationSheet с правильными значениями', () {
|
||||
test('creates UserRegistrationSheet with all parameters', () {
|
||||
const model = UserRegistrationSheet(
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
email: 'john@example.com',
|
||||
email: 'john.doe@example.com',
|
||||
password: 'password123',
|
||||
passwordConfirmation: 'password123',
|
||||
termsAccepted: 'accepted',
|
||||
birthdate: '1990-01-01',
|
||||
gender: 'male',
|
||||
location: 'Moscow',
|
||||
location: 'New York',
|
||||
responseBody: '{}',
|
||||
lang: 'ru',
|
||||
weight: 70,
|
||||
height: 175,
|
||||
phone: '+79001234567',
|
||||
lang: 'en',
|
||||
weight: 75,
|
||||
height: 180,
|
||||
phone: '+1234567890',
|
||||
chestCircumference: 100,
|
||||
waistCircumference: 80,
|
||||
hipCircumference: 90,
|
||||
@@ -25,19 +26,102 @@ void main() {
|
||||
bloodPressureDown: 80,
|
||||
hasHypo: 0,
|
||||
hasHyper: 0,
|
||||
aboutAllergy: 'No allergies',
|
||||
aboutTakingPils: 'No pills',
|
||||
aboutAllergy: 'None',
|
||||
aboutTakingPils: 'None',
|
||||
aboutSportHobbies: 'Running',
|
||||
favoriteFoods: 'Fruits',
|
||||
unfavoriteFoods: 'Fast food',
|
||||
additionalInfo: 'Additional info',
|
||||
favoriteFoods: 'Pizza',
|
||||
unfavoriteFoods: 'Broccoli',
|
||||
additionalInfo: 'No additional info',
|
||||
activityCoefficient: 1.5,
|
||||
);
|
||||
|
||||
expect(model.firstName, 'John');
|
||||
expect(model.email, 'john@example.com');
|
||||
expect(model.weight, 70);
|
||||
expect(model.lastName, 'Doe');
|
||||
expect(model.email, 'john.doe@example.com');
|
||||
expect(model.password, 'password123');
|
||||
expect(model.passwordConfirmation, 'password123');
|
||||
expect(model.termsAccepted, 'accepted');
|
||||
expect(model.birthdate, '1990-01-01');
|
||||
expect(model.gender, 'male');
|
||||
expect(model.location, 'New York');
|
||||
expect(model.weight, 75);
|
||||
expect(model.height, 180);
|
||||
expect(model.activityCoefficient, 1.5);
|
||||
});
|
||||
|
||||
test('creates UserRegistrationSheet with default values', () {
|
||||
const model = UserRegistrationSheet(
|
||||
firstName: 'Jane',
|
||||
lastName: 'Smith',
|
||||
email: 'jane@example.com',
|
||||
password: 'pass123',
|
||||
passwordConfirmation: 'pass123',
|
||||
birthdate: '1995-05-15',
|
||||
gender: 'female',
|
||||
location: 'London',
|
||||
responseBody: '{}',
|
||||
lang: 'en',
|
||||
weight: 60,
|
||||
height: 165,
|
||||
phone: '+9876543210',
|
||||
chestCircumference: 90,
|
||||
waistCircumference: 70,
|
||||
hipCircumference: 85,
|
||||
bloodPressureUp: 110,
|
||||
bloodPressureDown: 70,
|
||||
hasHypo: 0,
|
||||
hasHyper: 0,
|
||||
aboutAllergy: 'Peanuts',
|
||||
aboutTakingPils: 'Vitamins',
|
||||
aboutSportHobbies: 'Yoga',
|
||||
favoriteFoods: 'Salad',
|
||||
unfavoriteFoods: 'Fast food',
|
||||
additionalInfo: 'Vegetarian',
|
||||
);
|
||||
|
||||
expect(model.termsAccepted, 'accepted'); // default
|
||||
expect(model.activityCoefficient, 1.2); // default
|
||||
});
|
||||
|
||||
test('creates UserRegistrationSheet from JSON', () {
|
||||
final json = {
|
||||
'first_name': 'Test',
|
||||
'last_name': 'User',
|
||||
'email': 'test@example.com',
|
||||
'password': 'test123',
|
||||
'password_confirmation': 'test123',
|
||||
'terms': 'accepted',
|
||||
'birthdate': '2000-01-01',
|
||||
'gender': 'other',
|
||||
'location': 'Paris',
|
||||
'response_body': '{}',
|
||||
'lang': 'fr',
|
||||
'weight': 70,
|
||||
'height': 170,
|
||||
'phone': '+1111111111',
|
||||
'chest_circumference': 95,
|
||||
'waist_circumference': 75,
|
||||
'hip_circumference': 88,
|
||||
'blood_pressure_up': 115,
|
||||
'blood_pressure_down': 75,
|
||||
'has_hypo': 1,
|
||||
'has_hyper': 0,
|
||||
'about_alergy': 'Dairy',
|
||||
'about_taking_pils': 'None',
|
||||
'about_sport_hobbies': 'Swimming',
|
||||
'favorite_foods': 'Fish',
|
||||
'unfavorite_foods': 'Meat',
|
||||
'additional_info': 'Pescatarian',
|
||||
'activity_coefficient': 1.3,
|
||||
};
|
||||
|
||||
final model = UserRegistrationSheet.fromJson(json);
|
||||
|
||||
expect(model.firstName, 'Test');
|
||||
expect(model.lastName, 'User');
|
||||
expect(model.email, 'test@example.com');
|
||||
expect(model.hasHypo, 1);
|
||||
expect(model.hasHyper, 0);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user