Public Access
feat(meals): enforce three lower-calorie dinners with media
This commit is contained in:
@@ -3,7 +3,7 @@ from uuid import uuid4
|
||||
import pytest
|
||||
from pydantic import ValidationError
|
||||
|
||||
from app.schemas.recipe import RecipeCreate, RecipeIngredientRef, ResolveIngredientRequest
|
||||
from app.schemas.recipe import RecipeCreate, RecipeIngredientRef, RecipeRead, ResolveIngredientRequest
|
||||
|
||||
|
||||
def test_recipe_create_requires_canonical_ingredient_ids() -> None:
|
||||
@@ -36,6 +36,28 @@ def test_recipe_create_rejects_empty_ingredients() -> None:
|
||||
)
|
||||
|
||||
|
||||
def test_recipe_read_allows_nullable_discovered_recipe_fields() -> None:
|
||||
iid = uuid4()
|
||||
|
||||
payload = RecipeRead(
|
||||
id=uuid4(),
|
||||
name="Imported Recipe With Sparse Metadata",
|
||||
servings=4,
|
||||
prep_time_minutes=None,
|
||||
cook_time_minutes=None,
|
||||
cuisine_tags=[],
|
||||
dietary_tags=[],
|
||||
protein_type=None,
|
||||
ingredients=[RecipeIngredientRef(ingredient_id=iid, qty=1.0, unit="ea")],
|
||||
instructions=["Cook until done"],
|
||||
side_dishes=None,
|
||||
)
|
||||
|
||||
assert payload.prep_time_minutes is None
|
||||
assert payload.cook_time_minutes is None
|
||||
assert payload.protein_type is None
|
||||
|
||||
|
||||
def test_resolve_ingredient_request_round_trip() -> None:
|
||||
req = ResolveIngredientRequest(text="1 lb chicken thighs")
|
||||
assert req.text == "1 lb chicken thighs"
|
||||
|
||||
Reference in New Issue
Block a user