test(tests): add comprehensive unit tests for various models and repositories, enhancing test coverage and ensuring correct functionality

This commit is contained in:
mso7nueh
2025-12-09 16:19:48 +03:00
parent edd064d20d
commit 70e4a42e98
25 changed files with 2565 additions and 58 deletions

View File

@@ -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');
});
});
}