Added the recipes page at /recipes: paste a plain-text recipe (a… #9
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "osf/73-172-comparison-arm-single-small-scale"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What was done
Serves Nline, then one ingredient a line), scale it to the servings entered, and see each line that did not read reported with its line number.How to review
git fetch origin && git checkout osf/73-172-comparison-arm-single-small-scale; the diff againstorigin/compare/single-smallis the whole change.npm test— it provisions its own Postgres and runs every suite; expect all green, including the new reading, scaling, conversion, shopping-list and recipes-page / recipes-server suites.DATABASE_URLat a reachable Postgres (see the README's Run section),npm installandnpm start, then open http://localhost:3000/recipes — expect the recipe form (Recipe, Servings, Metric/US, Show recipe, Add to list) and "The shopping list is empty."Serves 2,200 g flour,a pinch of salt,2 eggs, set Servings to4and choose US, press Show recipe — expect14 oz flour,4 eggsand a redLine 3: a pinch of salt (no quantity); then press Add to list a few times and expect the list to sum by name and to refuse a sixth.Code review
Reviewed the whole scale-recipes-and-shopping-list commit: src/recipe.ts (UNITS, parseQuantity, parseIngredientLine, parseRecipe), src/scale.ts (scaleRecipe, formatAmount, formatIngredient), src/convert.ts (System, convertIngredient), src/shopping.ts (MAX_RECIPES, addRecipe, shoppingList), the recipesPage in src/pages.ts, the GET/POST /recipes routes in src/server.ts (sitting before the GET /
branch), the six new scenario-tagged test files, the pre-existing test/server.test.ts, e2e/recipes.spec.ts, and the README.md/CHANGELOG.md/tasks.md docs changes. Manually verified the arithmetic (200 g -> 14 oz at x2, 1500 g -> 1.5 kg, 2 l -> 8.454 cup, 120 ml -> 0.507 cup, 9.96 -> "10 oz", 0.05 tsp -> "1/4 tsp", 7/24 tie -> 1/4) and the shopping-list sort (no unit first, then UNITS order). Three edge cases were deliberately judged NOT findings: (a) the hidden-field toFixed(6).replace making "0.000000" into "" at src/server.ts:131 is unreachable because parseQuantity refuses 0, the scale factor is positive, and the hidden fields re-parse through the same reader; (b) scaleRecipe accepting "4.0" as 4 is fine, the spec only pins 0/2.5/two as refused; (c) a recipe with no Serves line and no ingredients is not covered by the spec. The six-decimal round-trip is proven by the e2e test (4 eggs + 2 eggs -> 6 eggs). No generated, cached or secret files in the commit; .gitignore already covers node_modules/, test-results/ and playwright-report/; the .osf/* records are meant to be committed. No code changes were made: every check passed; the only failure in the whole run was a bug in my own runner script (DATABASE_URL sourced without export, so the Playwright webServer never saw it), which was fixed outside the repo and the e2e run then passed 2/2.It found nothing to fix.
Tests
All 47 scenarios of
scale-recipes-and-shopping-listhave a tagged test.The test lint found, in the run's tests on the last check:
Recorded, not decided
e2e/recipes.spec.ts:1B7: no relative import: this file asserts on things it constructed itself, which is the measured 'asserted on my own mock' failuretest/recipes-page.test.ts:1B7: nothing imported here looks like the module under test ('recipes-page')test/recipes-server.test.ts:1B7: nothing imported here looks like the module under test ('recipes-server')Braid run
scale-recipes-and-shopping-list(22 steps)0f280b1257Opened by Braid.
cc8599ab750f280b1257Scale a recipe, convert its units, and build a shopping listto Added the recipes page at /recipes: paste a plain-text recipe (a…0f280b1257add69a60a8