| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
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.
| Back | FazBrowse Home | New Git URL |
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:
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.