Nobody has started this yet — be first.
Business impact
GET /recipes/search?ingredient=... is the primary way a user finds recipes by what's in their fridge -- "what can I make with chicken?" It's documented as case-insensitive (README.md's endpoint table says exactly that), and until recently it was. Now, any query whose capitalization doesn't happen to match how the ingredient was originally typed into the database returns zero results -- not an error, just an empty, unhelpful list. Since most real users type search terms in lowercase or Title Case without checking how any given recipe author capitalized "Chicken Breast" vs "chicken breast," this silently breaks the feature for the majority of real-world queries while looking, to an automated smoke test that happens to match case, like it still works fine.
Problem
GET /recipes/search?ingredient=CHICKEN does not match an ingredient stored as "chicken breast". Only an exact-case (or coincidentally-cased) substring match succeeds.
Current behavior
Searching for an ingredient in a different case than it was stored in (e.g. CHICKEN vs the stored "chicken breast") returns an empty result list instead of the matching recipe.
Expected behavior
GET /recipes/search?ingredient=<query> should match ingredient names case-insensitively, as it's documented to (README endpoint table: "Recipes containing that ingredient (case-insensitive, partial match)").
Steps to reproduce
curl -X POST http://localhost:3001/recipes -H "Content-Type: application/json" -d '{ "title": "Chicken Stir Fry", "cookingTimeMinutes": 20, "servings": 4, "ingredients": [{"name": "chicken breast", "quantity": 500, "unit": "g"}], "steps": [{"stepNumber": 1, "instruction": "Cook it."}] }'
curl "http://localhost:3001/recipes/search?ingredient=CHICKEN"
Why this matters
This is a real regression pattern: the where clause inside the GET /search handler still filters on name, still uses contains -- it looks right on a casual read -- but the mode: 'insensitive' Prisma option that makes Postgres's contains case-fold is simply absent from the search handler's where clause. This is exactly the kind of change that passes a casual code read and only fails when you actually run a query with mismatched case, which is why a dedicated regression test matters here more than most.
Suggested approach
Compare the where clause inside the GET /search handler in src/routes/recipes.js against the Prisma docs for case-insensitive string filtering on Postgres (the option name is one word, and it's a sibling key next to contains inside the same object). There's a single missing key to restore.
Acceptance criteria
Verification
npx jest --config practice-tickets/jest.config.js practice-tickets/tests/04-search-case-sensitive-regression.test.js
Hints (0/2)
Try it without hints first — the reading is the exercise.
Working on this ticket
Work on a branch named for the ticket — that's what you'll submit.
Branch off your fork
$git checkout -b fix/search-case-sensitive-regressionFix it and commit
Meet every acceptance criterion, and add a test that would have caught this.
Push the branch
$git push -u origin fix/search-case-sensitive-regressionSubmit it below
Paste your fork URL and the branch name, with a short write-up of the root cause.
Questions
Ask about anything unclear in the ticket — the maintainer and anyone who has solved it can answer. Please don't post full solutions.
Sign in to ask a question or reply.
Sign indocker-entrypoint.shnpx prisma migrate deploydocker compose up --builddocker compose down -vWithout Docker: npm install, copy .env.example to .env and point DATABASE_URL at a local PostgreSQL instance, then npm run prisma:migrate:dev and npm run dev (nodemon, port 3001) or npm start.
The project's own suite (tests/recipes.test.js) runs against a real Postgres test database, not a mock -- create one, copy .env.example to .env.test and point it at that database, then run:
npm test
Work the tickets in practice-tickets/tickets/ (01 through 07); each names one Jest test in practice-tickets/tests/, run against the same real test database via practice-tickets/jest.config.js:
npx jest --config practice-tickets/jest.config.js practice-tickets/tests/01-max-cooking-time-boundary.test.js # a single ticket
./practice-tickets/run.sh # all 7, clean pass/fail summary
Fixing tickets 02 and 04 also turns two tests in the project's own npm test suite green again -- they break as a direct, expected side effect of those bugs touching shared route code the existing suite also exercises. That's expected, not a mistake in the scaffolding.
Level 1
Fix a bug
Read existing behaviour, correct it.