mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-08-05 21:45:25 +02:00
feat: adding the rest ofthe nutrition properties from schema.org (#4301)
This commit is contained in:
parent
3aea229f2d
commit
02c0fe993b
16 changed files with 279 additions and 57 deletions
|
@ -481,20 +481,24 @@ nutrition_test_cases = (
|
|||
},
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="special support for sodiumContent (g -> mg)",
|
||||
test_id="special support for sodiumContent/cholesterolContent (g -> mg)",
|
||||
input={
|
||||
"cholesterolContent": "10g",
|
||||
"sodiumContent": "10g",
|
||||
},
|
||||
expected={
|
||||
"cholesterolContent": "10000.0",
|
||||
"sodiumContent": "10000.0",
|
||||
},
|
||||
),
|
||||
CleanerCase(
|
||||
test_id="special support for sodiumContent (mg -> mg)",
|
||||
test_id="special support for sodiumContent/cholesterolContent (mg -> mg)",
|
||||
input={
|
||||
"cholesterolContent": "10000mg",
|
||||
"sodiumContent": "10000mg",
|
||||
},
|
||||
expected={
|
||||
"cholesterolContent": "10000",
|
||||
"sodiumContent": "10000",
|
||||
},
|
||||
),
|
||||
|
|
|
@ -23,6 +23,12 @@ async def test_recipe_parser(recipe_test_data: RecipeSiteTestCase):
|
|||
recipe, _ = await scraper.create_from_html(recipe_test_data.url, translator)
|
||||
|
||||
assert recipe.slug == recipe_test_data.expected_slug
|
||||
|
||||
assert len(recipe.recipe_instructions or []) == recipe_test_data.num_steps
|
||||
|
||||
assert len(recipe.recipe_ingredient) == recipe_test_data.num_ingredients
|
||||
|
||||
actual = recipe.nutrition.model_dump() if recipe.nutrition else {}
|
||||
assert recipe_test_data.num_nutrition_entries == len(actual.items())
|
||||
|
||||
assert recipe.org_url == recipe_test_data.url
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue