chore(version): update app version to 1.3.5+85 and improve test coverage reporting in CI

This commit is contained in:
mso7nueh
2025-12-08 11:19:08 +03:00
parent abe4985f0e
commit c2a506cdbf
148 changed files with 12395 additions and 1889 deletions

View File

@@ -2,154 +2,122 @@ import 'package:eatvio_app/core/models/pagination_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('PaginationModel', () {
group('Links', () {
test('создает Links с правильными значениями', () {
const links = Links(
first: 'https://example.com?page=1',
last: 'https://example.com?page=10',
prev: null,
next: 'https://example.com?page=2',
);
group('Links', () {
test('creates Links with all parameters', () {
final links = Links(
first: 'http://example.com?page=1',
last: 'http://example.com?page=10',
prev: 'http://example.com?page=2',
next: 'http://example.com?page=4',
);
expect(links.first, 'https://example.com?page=1');
expect(links.last, 'https://example.com?page=10');
expect(links.prev, isNull);
expect(links.next, 'https://example.com?page=2');
});
test('fromJson создает Links из JSON', () {
final json = {
'first': 'https://example.com?page=1',
'last': 'https://example.com?page=10',
'prev': null,
'next': 'https://example.com?page=2',
};
final links = Links.fromJson(json);
expect(links.first, 'https://example.com?page=1');
expect(links.last, 'https://example.com?page=10');
expect(links.prev, isNull);
expect(links.next, 'https://example.com?page=2');
});
expect(links.first, 'http://example.com?page=1');
expect(links.last, 'http://example.com?page=10');
expect(links.prev, 'http://example.com?page=2');
expect(links.next, 'http://example.com?page=4');
});
group('Link', () {
test('создает Link с правильными значениями', () {
const link = Link(
url: 'https://example.com?page=2',
label: '2',
active: true,
);
test('creates Links with null prev and next', () {
final links = Links(
first: 'http://example.com?page=1',
last: 'http://example.com?page=10',
prev: null,
next: null,
);
expect(link.url, 'https://example.com?page=2');
expect(link.label, '2');
expect(link.active, isTrue);
});
expect(links.prev, null);
expect(links.next, null);
});
});
test('создает Link с null значениями', () {
const link = Link(
url: null,
label: null,
active: null,
);
group('Link', () {
test('creates Link with all parameters', () {
final link = Link(
url: 'http://example.com?page=1',
label: '1',
active: true,
);
expect(link.url, isNull);
expect(link.label, isNull);
expect(link.active, isNull);
});
test('fromJson создает Link из JSON', () {
final json = {
'url': 'https://example.com?page=2',
'label': '2',
'active': true,
};
final link = Link.fromJson(json);
expect(link.url, 'https://example.com?page=2');
expect(link.label, '2');
expect(link.active, isTrue);
});
expect(link.url, 'http://example.com?page=1');
expect(link.label, '1');
expect(link.active, true);
});
group('Meta', () {
test('создает Meta с правильными значениями', () {
const meta = Meta(
currentPage: 1,
from: 1,
lastPage: 10,
links: [],
path: 'https://example.com',
perPage: 20,
to: 20,
total: 200,
totalMinPrice: 100,
totalMaxPrice: 1000,
);
test('creates Link with null values', () {
final link = Link(
url: null,
label: null,
active: null,
);
expect(meta.currentPage, 1);
expect(meta.from, 1);
expect(meta.lastPage, 10);
expect(meta.links, isEmpty);
expect(meta.path, 'https://example.com');
expect(meta.perPage, 20);
expect(meta.to, 20);
expect(meta.total, 200);
expect(meta.totalMinPrice, 100);
expect(meta.totalMaxPrice, 1000);
});
expect(link.url, null);
expect(link.label, null);
expect(link.active, null);
});
});
test('создает Meta с null значениями', () {
const meta = Meta(
currentPage: 1,
from: null,
lastPage: 1,
links: [],
path: null,
perPage: 20,
to: null,
total: 0,
totalMinPrice: null,
totalMaxPrice: null,
);
group('Meta', () {
test('creates Meta with all parameters', () {
final meta = Meta(
currentPage: 1,
from: 1,
lastPage: 10,
links: [],
path: '/api/items',
perPage: 20,
to: 20,
total: 200,
totalMinPrice: 100,
totalMaxPrice: 1000,
);
expect(meta.from, isNull);
expect(meta.path, isNull);
expect(meta.to, isNull);
expect(meta.totalMinPrice, isNull);
expect(meta.totalMaxPrice, isNull);
});
expect(meta.currentPage, 1);
expect(meta.lastPage, 10);
expect(meta.perPage, 20);
expect(meta.total, 200);
expect(meta.totalMinPrice, 100);
expect(meta.totalMaxPrice, 1000);
});
test('fromJson создает Meta из JSON', () {
final json = {
'current_page': 1,
'from': 1,
'last_page': 10,
'links': [],
'path': 'https://example.com',
'per_page': 20,
'to': 20,
'total': 200,
'total_min_price': 100,
'total_max_price': 1000,
};
test('creates Meta with null optional values', () {
final meta = Meta(
currentPage: 1,
from: null,
lastPage: 10,
links: [],
path: null,
perPage: 20,
to: null,
total: 200,
totalMinPrice: null,
totalMaxPrice: null,
);
final meta = Meta.fromJson(json);
expect(meta.path, null);
expect(meta.totalMinPrice, null);
expect(meta.totalMaxPrice, null);
});
expect(meta.currentPage, 1);
expect(meta.from, 1);
expect(meta.lastPage, 10);
expect(meta.path, 'https://example.com');
expect(meta.perPage, 20);
expect(meta.to, 20);
expect(meta.total, 200);
expect(meta.totalMinPrice, 100);
expect(meta.totalMaxPrice, 1000);
});
test('creates Meta with links list', () {
final links = [
Link(url: 'http://example.com?page=1', label: '1', active: true),
Link(url: 'http://example.com?page=2', label: '2', active: false),
];
final meta = Meta(
currentPage: 1,
from: 1,
lastPage: 10,
links: links,
path: '/api/items',
perPage: 20,
to: 20,
total: 200,
);
expect(meta.links.length, 2);
expect(meta.links[0].label, '1');
expect(meta.links[1].label, '2');
});
});
}