Public Access
feat(meals): enforce three lower-calorie dinners with media
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import uuid
|
||||
|
||||
from app.api.llm_plan import _validate_picks
|
||||
|
||||
|
||||
def test_validate_picks_accepts_only_dinners():
|
||||
recipe_id = str(uuid.uuid4())
|
||||
|
||||
picks = _validate_picks(
|
||||
[
|
||||
{"day_of_week": 1, "meal_type": "breakfast", "recipe_id": recipe_id},
|
||||
{"day_of_week": 1, "meal_type": "lunch", "recipe_id": recipe_id},
|
||||
{"day_of_week": 1, "meal_type": "dinner", "recipe_id": recipe_id},
|
||||
],
|
||||
{recipe_id},
|
||||
)
|
||||
|
||||
assert [(pick.day_of_week, pick.meal_type) for pick in picks] == [(1, "dinner")]
|
||||
|
||||
|
||||
def test_validate_picks_limits_schedule_to_three_unique_dinners():
|
||||
recipe_ids = [str(uuid.uuid4()) for _ in range(5)]
|
||||
|
||||
picks = _validate_picks(
|
||||
[
|
||||
{"day_of_week": 1, "meal_type": "dinner", "recipe_id": recipe_ids[0]},
|
||||
{"day_of_week": 2, "meal_type": "dinner", "recipe_id": recipe_ids[1]},
|
||||
{"day_of_week": 3, "meal_type": "dinner", "recipe_id": recipe_ids[2]},
|
||||
{"day_of_week": 3, "meal_type": "dinner", "recipe_id": recipe_ids[3]},
|
||||
{"day_of_week": 5, "meal_type": "dinner", "recipe_id": recipe_ids[4]},
|
||||
],
|
||||
set(recipe_ids),
|
||||
)
|
||||
|
||||
assert [(pick.day_of_week, pick.recipe_id) for pick in picks] == [
|
||||
(1, recipe_ids[0]),
|
||||
(3, recipe_ids[2]),
|
||||
(5, recipe_ids[4]),
|
||||
]
|
||||
Reference in New Issue
Block a user