fix: issue-372, issue-227, issue-406

This commit is contained in:
misha
2026-09-02 09:32:14 +03:00
parent 10af279d87
commit c6ea1d414d
34 changed files with 1623 additions and 387 deletions

View File

@@ -100,6 +100,22 @@ void main() {
expect(model.dietId, 5);
});
test('creates ChosenDietModel from JSON with null chosen_plan_id as public diet', () {
final json = {
'id': 1,
'chosen_plan_id': null,
'state': 'started',
'start_date': '2023-01-01T00:00:00Z',
'diet': {'id': 5},
};
final model = ChosenDietModel.fromJson(json);
expect(model.chosenDietID, 1);
expect(model.chosenPlanId, 0);
expect(model.dietId, 5);
});
test('creates ChosenDietModel with null dietId', () {
final model = ChosenDietModel(
chosenDietID: 1,