FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(curriculum): make digital pet game fetch stub response-like by majestic-owl448 · Pull Request #69578 · freeCodeCamp/freeCodeCamp · GitHub

fix(curriculum): make digital pet game fetch stub response-like - #69578

Open
majestic-owl448 wants to merge 1 commit into
freeCodeCamp:mainfrom
majestic-owl448:fix/digital-pet-fetch-stub
Open

fix(curriculum): make digital pet game fetch stub response-like#69578
majestic-owl448 wants to merge 1 commit into
freeCodeCamp:mainfrom
majestic-owl448:fix/digital-pet-fetch-stub

Conversation

Copy link
Copy Markdown
Contributor

Checklist:

Same class of problem as #69574. The fetch stub in this lab fails camper code that passes against the live endpoint on production.

The object it resolved to only had a json method:

window.fetch = () => Promise.resolve({ json: () => Promise.resolve('Cats sleep for around 13 to 16 hours a day.') });

So a solution guarding the response, which is what campers are normally taught to write, always takes the error path because response.ok is undefined. The stub now resolves to something closer to a Response, with ok, status, statusText and text alongside json, and the fact itself moved to a variable so json and text cannot drift apart.

Unlike #69574, the resolution stays in a microtask here on purpose: __FakeTimers.install() runs in the same --before-all-- block, before the camper's code, so a stub resolving from a setTimeout would never settle unless a hint advanced the clock.

Verified locally with FCC_BLOCK=lab-digital-pet-game pnpm run test-curriculum-content.

The stub resolved to an object with only a json method, so a solution
guarding on response.ok always threw. The stub keeps resolving in a
microtask because fake timers are installed before the camper's code
runs.
github-actions Bot added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. labels Aug 17, 2026

This comment has been minimized.

1 similar comment

This comment was marked as outdated.

github-actions Bot removed the deprioritized PR reviews are deprioritized; lacks productive input and ignores codebase best practices. label Aug 17, 2026
majestic-owl448 marked this pull request as ready for review August 19, 2026 21:00
majestic-owl448 requested review from a team as code owners August 19, 2026 21:00
majestic-owl448 added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label Aug 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant


Back | FazBrowse Home | New Git URL