Files
eatvio_app/test/features/calendar/models/calendar_model_test.dart

45 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/calendar/models/calendar_model.dart';
import 'package:flutter_test/flutter_test.dart';
void main() {
group('CalendarModel', () {
test('создает экземпляр с данными', () {
const model = CalendarModel(
date: '2024-01-15',
isCurrentDayIncludedInTheChosenDietProgression: true,
diary: null,
);
expect(model.date, '2024-01-15');
expect(model.isCurrentDayIncludedInTheChosenDietProgression, true);
expect(model.diary, null);
});
test('fromJson создает модель из JSON', () {
final json = {
'date': '2024-01-15',
'is_current_day_included_in_the_chosen_diet_progression': true,
'diary': null,
};
final model = CalendarModel.fromJson(json);
expect(model.date, '2024-01-15');
expect(model.isCurrentDayIncludedInTheChosenDietProgression, true);
});
test('toJson преобразует модель в JSON', () {
const model = CalendarModel(
date: '2024-01-15',
isCurrentDayIncludedInTheChosenDietProgression: true,
diary: null,
);
final json = model.toJson();
expect(json['date'], '2024-01-15');
expect(json['is_current_day_included_in_the_chosen_diet_progression'], true);
});
});
}