feat(dependencies): add rxdart package and improve string extension methods for better handling of empty strings and gender parsing

This commit is contained in:
mso7nueh
2025-12-04 15:45:54 +03:00
parent 0cd8e662d9
commit 953230b387
100 changed files with 7202 additions and 14 deletions

View File

@@ -0,0 +1,95 @@
import 'package:eatvio_app/core/models/pagination_model.dart';
import 'package:eatvio_app/features/feed/models/feed_consultant_model.dart';
import 'package:eatvio_app/features/profile/models/badge_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('FeedConsultantModel', () {
test('создает FeedConsultantModel с правильными значениями', () {
const model = FeedConsultantModel(
slug: 'consultant-1',
name: 'Consultant Name',
description: 'Test description',
ratingPlace: 1,
totalScores: 450,
photo: 'https://example.com/photo.jpg',
badges: [
BadgeModel(
id: 1,
title: 'Badge 1',
description: 'Description',
image: 'https://example.com/badge1.jpg',
type: 'type',
),
],
);
expect(model.slug, 'consultant-1');
expect(model.name, 'Consultant Name');
expect(model.totalScores, 450);
expect(model.badges.length, 1);
});
test('fromJson создает FeedConsultantModel из JSON', () {
final json = {
'slug': 'consultant-1',
'name': 'Consultant Name',
'additional_info': 'Test description',
'rating_place': 1,
'total_scores': 450,
'profile_photo_url': 'https://example.com/photo.jpg',
'badges': [
{
'id': 1,
'title': 'Badge 1',
'description': 'Description',
'image': 'https://example.com/badge1.jpg',
'type': 'type'
},
],
};
final model = FeedConsultantModel.fromJson(json);
expect(model.slug, 'consultant-1');
expect(model.totalScores, 450);
});
});
group('FeedConsultantPaginationModel', () {
test('создает FeedConsultantPaginationModel с правильными значениями', () {
const consultant = FeedConsultantModel(
slug: 'consultant-1',
name: 'Consultant Name',
description: 'Test description',
ratingPlace: null,
totalScores: 450,
photo: 'https://example.com/photo.jpg',
badges: [],
);
const pagination = FeedConsultantPaginationModel(
data: [consultant],
links: Links(
first: 'https://example.com?page=1',
last: 'https://example.com?page=1',
prev: null,
next: null,
),
meta: Meta(
currentPage: 1,
from: 1,
lastPage: 1,
links: [],
perPage: 10,
to: 1,
total: 1,
),
);
expect(pagination.data.length, 1);
expect(pagination.data.first.slug, 'consultant-1');
});
});
}