forked from eatvio/eatvio_app
85 lines
2.6 KiB
Dart
85 lines
2.6 KiB
Dart
import 'package:eatvio_app/features/registration_v2/models/registration_model.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
void main() {
|
|
group('RegistrationModel', () {
|
|
test('creates RegistrationModel with all parameters', () {
|
|
final model = RegistrationModel(
|
|
firstName: 'John',
|
|
lastName: 'Doe',
|
|
email: 'john.doe@example.com',
|
|
phone: '+1234567890',
|
|
gender: 'male',
|
|
password: 'password123',
|
|
confirmPassword: 'password123',
|
|
weight: 75,
|
|
height: 180,
|
|
activityCoefficient: 1.5,
|
|
birthday: '1990-01-01',
|
|
);
|
|
|
|
expect(model.firstName, 'John');
|
|
expect(model.lastName, 'Doe');
|
|
expect(model.email, 'john.doe@example.com');
|
|
expect(model.phone, '+1234567890');
|
|
expect(model.gender, 'male');
|
|
expect(model.password, 'password123');
|
|
expect(model.confirmPassword, 'password123');
|
|
expect(model.weight, 75);
|
|
expect(model.height, 180);
|
|
expect(model.activityCoefficient, 1.5);
|
|
expect(model.birthday, '1990-01-01');
|
|
});
|
|
|
|
test('creates RegistrationModel from JSON', () {
|
|
final json = {
|
|
'first_name': 'Jane',
|
|
'last_name': 'Smith',
|
|
'email': 'jane.smith@example.com',
|
|
'phone': '+9876543210',
|
|
'gender': 'female',
|
|
'password': 'securepass456',
|
|
'password_confirmation': 'securepass456',
|
|
'weight': 60,
|
|
'height': 165,
|
|
'activity_coefficient': 1.3,
|
|
'birthdate': '1995-05-15',
|
|
};
|
|
|
|
final model = RegistrationModel.fromJson(json);
|
|
|
|
expect(model.firstName, 'Jane');
|
|
expect(model.lastName, 'Smith');
|
|
expect(model.email, 'jane.smith@example.com');
|
|
expect(model.phone, '+9876543210');
|
|
expect(model.gender, 'female');
|
|
expect(model.password, 'securepass456');
|
|
expect(model.confirmPassword, 'securepass456');
|
|
expect(model.weight, 60);
|
|
expect(model.height, 165);
|
|
expect(model.activityCoefficient, 1.3);
|
|
expect(model.birthday, '1995-05-15');
|
|
});
|
|
|
|
test('creates RegistrationModel with different values', () {
|
|
final model = RegistrationModel(
|
|
firstName: 'Test',
|
|
lastName: 'User',
|
|
email: 'test@test.com',
|
|
phone: '+1111111111',
|
|
gender: 'other',
|
|
password: 'test123',
|
|
confirmPassword: 'test123',
|
|
weight: 80,
|
|
height: 175,
|
|
activityCoefficient: 1.2,
|
|
birthday: '2000-12-31',
|
|
);
|
|
|
|
expect(model.firstName, 'Test');
|
|
expect(model.weight, 80);
|
|
expect(model.height, 175);
|
|
});
|
|
});
|
|
}
|