forked from eatvio/eatvio_app
test(tests): add comprehensive unit tests for various models and repositories, enhancing test coverage and ensuring correct functionality
This commit is contained in:
@@ -23,6 +23,31 @@ void main() {
|
||||
expect(model.login, 'test@yandex.ru');
|
||||
expect(model.defaultPhone.number, '+79001234567');
|
||||
});
|
||||
|
||||
test('fromJson создает YandexProfileModel из JSON', () {
|
||||
final json = {
|
||||
'id': '123',
|
||||
'login': 'test@yandex.ru',
|
||||
'birthday': '1990-01-01',
|
||||
'client_id': 'client-123',
|
||||
'display_name': 'Display Name',
|
||||
'real_name': 'Real Name',
|
||||
'first_name': 'First',
|
||||
'last_name': 'Last',
|
||||
'sex': 'male',
|
||||
'default_email': 'test@yandex.ru',
|
||||
'default_phone': {
|
||||
'id': 1,
|
||||
'number': '+79001234567',
|
||||
},
|
||||
};
|
||||
|
||||
final model = YandexProfileModel.fromJson(json);
|
||||
|
||||
expect(model.id, '123');
|
||||
expect(model.login, 'test@yandex.ru');
|
||||
expect(model.defaultPhone.number, '+79001234567');
|
||||
});
|
||||
});
|
||||
|
||||
group('YandexPhoneData', () {
|
||||
@@ -32,6 +57,18 @@ void main() {
|
||||
expect(phoneData.id, 1);
|
||||
expect(phoneData.number, '+79001234567');
|
||||
});
|
||||
|
||||
test('fromJson создает YandexPhoneData из JSON', () {
|
||||
final json = {
|
||||
'id': 1,
|
||||
'number': '+79001234567',
|
||||
};
|
||||
|
||||
final phoneData = YandexPhoneData.fromJson(json);
|
||||
|
||||
expect(phoneData.id, 1);
|
||||
expect(phoneData.number, '+79001234567');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user