feat(tests): test coverage is 70.5

This commit is contained in:
misha
2026-01-26 16:38:15 +03:00
parent 92205c09d6
commit 29589ef6fd
49 changed files with 2690 additions and 18 deletions

View File

@@ -0,0 +1,77 @@
import 'package:eatvio_app/core/data/selectionPopupModel/selection_popup_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('SelectionPopupModel', () {
test('creates instance with required fields', () {
const model = SelectionPopupModel(title: 'Test Title');
expect(model.title, 'Test Title');
expect(model.id, isNull);
expect(model.value, isNull);
expect(model.isSelected, isFalse);
});
test('creates instance with all fields', () {
const model = SelectionPopupModel(
id: 1,
title: 'Test Title',
value: 'test_value',
isSelected: true,
);
expect(model.id, 1);
expect(model.title, 'Test Title');
expect(model.value, 'test_value');
expect(model.isSelected, isTrue);
});
test('creates instance with default isSelected false', () {
const model = SelectionPopupModel(title: 'Test Title');
expect(model.isSelected, isFalse);
});
test('creates instance with isSelected true', () {
const model = SelectionPopupModel(
title: 'Test Title',
isSelected: true,
);
expect(model.isSelected, isTrue);
});
test('creates instance with different value types', () {
const model1 = SelectionPopupModel(title: 'Test', value: 'string');
const model2 = SelectionPopupModel(title: 'Test', value: 123);
const model3 = SelectionPopupModel(title: 'Test', value: true);
expect(model1.value, 'string');
expect(model2.value, 123);
expect(model3.value, true);
});
test('equality works correctly', () {
const model1 = SelectionPopupModel(id: 1, title: 'Test', isSelected: true);
const model2 = SelectionPopupModel(id: 1, title: 'Test', isSelected: true);
const model3 = SelectionPopupModel(id: 2, title: 'Test', isSelected: true);
expect(model1, equals(model2));
expect(model1, isNot(equals(model3)));
});
test('copyWith creates new instance with updated values', () {
const original = SelectionPopupModel(title: 'Original');
final updated = original.copyWith(
id: 1,
isSelected: true,
value: 'new_value',
);
expect(updated.id, 1);
expect(updated.title, 'Original');
expect(updated.isSelected, isTrue);
expect(updated.value, 'new_value');
});
});
}