mirror of
https://github.com/wger-project/flutter.git
synced 2026-02-19 07:50:52 +01:00
more tests
This commit is contained in:
@@ -31,7 +31,7 @@ void main() {
|
||||
});
|
||||
|
||||
group('model tests', () {
|
||||
test('Test the nutritionalValues method for nutritional plans', () {
|
||||
test('Test NutritionalPlan.nutritionalGoals based on meals', () {
|
||||
expect(
|
||||
plan.nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
@@ -44,6 +44,55 @@ void main() {
|
||||
fibres: 52.5,
|
||||
sodium: 30.5));
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 3 macros and energy', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '3 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 150,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 100,
|
||||
goalEnergy: 1500,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1500,
|
||||
protein: 150,
|
||||
carbohydrates: 100,
|
||||
fat: 100,
|
||||
));
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 2 macros and energy', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '2 macros and energy defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalEnergy: 1700,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 1700,
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 100, // inferred
|
||||
));
|
||||
});
|
||||
test('Test NutritionalPlan.nutritionalValues based on 3 macros only', () {
|
||||
expect(
|
||||
NutritionalPlan(
|
||||
description: '3 macros defined',
|
||||
creationDate: DateTime(2024, 5, 4),
|
||||
goalProtein: 100,
|
||||
goalCarbohydrates: 100,
|
||||
goalFat: 10,
|
||||
).nutritionalGoals,
|
||||
NutritionalGoals(
|
||||
energy: 890, // inferred
|
||||
protein: 100,
|
||||
carbohydrates: 100,
|
||||
fat: 10,
|
||||
));
|
||||
});
|
||||
|
||||
test('Test the nutritionalValues method for meals', () {
|
||||
final meal = plan.meals.first;
|
||||
|
||||
@@ -27,8 +27,6 @@ import 'package:wger/providers/base_provider.dart';
|
||||
import 'package:wger/providers/body_weight.dart';
|
||||
import 'package:wger/providers/nutrition.dart';
|
||||
import 'package:wger/screens/nutritional_plan_screen.dart';
|
||||
import 'package:wger/widgets/nutrition/charts.dart';
|
||||
|
||||
import '../../test_data/nutritional_plans.dart';
|
||||
import 'nutritional_plan_screen_test.mocks.dart';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user