freeCodeCamp / freeCodeCamp/back-end-development-and-apis
Bank API lessons 13 and 14 accept missing error handling
- Dominant language
- JavaScript
- Stars
- 32
- Forks
- 217
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
### Describe the bug
The missing-account error tests in Build a Bank API lessons 13 and 14 can pass without the required error handling. They search the whole `server.js` file for nearby words and numbers instead of checking that the relevant branch sets `err.status = 404` and throws the error.
### To reproduce
1. In lesson 13, keep the account lookup code but replace the missing-sender error branch with `// sender 404`. The missing-sender assertion passes.
2. In lesson 14, retain the correct sender error branch and add the recipient lookup. Remove both `err.status = 404` and `throw err` from the recipient branch. The missing-recipient assertion still passes by matching the sender branch's `404` followed by `const recipient`.
These results were reproduced by running the current assertions in isolation against the code examples, using commit `4aa3fa848854a02c4ca1b2f7d34bd44fdb2f0a7a`.
### Expected behavior
Each test should require a thrown error with status `404` for its own missing-account condition. Comments and status assignments in another branch should not satisfy it. Correct code should pass regardless of ordinary formatting or capitalization in the error message.
### Additional context
The related false failure in lesson 13 is already reported in https://github.com/freeCodeCamp/back-end-development-and-apis/issues/55. Widening the regex and making it case-insensitive would not address these false positives.
Affected file: `curriculum/locales/english/build-a-bank-api.md`.
Original report: https://forum.freecodecamp.org/t/build-a-bank-api-build-a-bank-api/799338
Contributor guide
Research direction
Open curriculum/locales/english/build-a-bank-api.md and locate the lesson 13 and 14 missing-account assertions. Run the affected assertions against the examples at commit 4aa3fa848854a02c4ca1b2f7d34bd44fdb2f0a7a; update the checks so each branch must throw an error with status 404, then verify that comments or another branch cannot satisfy the test and ordinary error-message formatting still passes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- documentation, testing-qa
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100