forked from eatvio/eatvio_app
fix: issue-372, issue-227, issue-406
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user