forked from eatvio/eatvio_app
feat(tests): updated tests coverage to 66.5%
This commit is contained in:
29
test/features/diary/models/diary_index_model_test.dart
Normal file
29
test/features/diary/models/diary_index_model_test.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:eatvio_app/features/diary/models/diary_index_model.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
group('DiaryIndexModel', () {
|
||||
test('fromJson parses id correctly', () {
|
||||
final json = {'id': 123};
|
||||
|
||||
final model = DiaryIndexModel.fromJson(json);
|
||||
|
||||
expect(model.id, 123);
|
||||
});
|
||||
|
||||
test('toJson serializes id correctly', () {
|
||||
const model = DiaryIndexModel(id: 123);
|
||||
|
||||
final json = model.toJson();
|
||||
|
||||
expect(json['id'], 123);
|
||||
});
|
||||
|
||||
test('creates instance with id', () {
|
||||
const model = DiaryIndexModel(id: 456);
|
||||
|
||||
expect(model.id, 456);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user