Files
eatvio_app/test/features/complaining/models/complain_model_test.dart

48 lines
1.3 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:eatvio_app/features/complaining/models/complain_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('ComplainModel', () {
test('создает экземпляр с дефолтными значениями', () {
const model = ComplainModel();
expect(model.description, null);
expect(model.tags, []);
});
test('создает экземпляр с description и tags', () {
const model = ComplainModel(
description: 'Test description',
tags: ['tag1', 'tag2'],
);
expect(model.description, 'Test description');
expect(model.tags, ['tag1', 'tag2']);
});
test('fromJson создает модель из JSON', () {
final json = {
'description': 'Test description',
'tags': ['tag1', 'tag2'],
};
final model = ComplainModel.fromJson(json);
expect(model.description, 'Test description');
expect(model.tags, ['tag1', 'tag2']);
});
test('toJson преобразует модель в JSON', () {
const model = ComplainModel(
description: 'Test description',
tags: ['tag1', 'tag2'],
);
final json = model.toJson();
expect(json['description'], 'Test description');
expect(json['tags'], ['tag1', 'tag2']);
});
});
}