forked from eatvio/eatvio_app
30 lines
646 B
Dart
30 lines
646 B
Dart
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);
|
|
});
|
|
});
|
|
}
|
|
|