Feat/graphql challenge map readme/tests update#578
Conversation
- Add scripts/build-challenge-map-graphql.mjs to generate challengeMap.json
* Fetches curriculum from FCC GraphQL API
* Builds flat map with { certification, block, name } structure
* Output: data/challengeMap.json with 12,847 unique challenges
* Run: node scripts/build-challenge-map-graphql.mjs
- Add util/challengeMapUtils.js for transforming student data
* resolveAllStudentsToDashboardFormat() - converts FCC Proper student data to dashboard format
* buildStudentDashboardData() - groups challenges by certification and block
- Update .gitignore to exclude generated data/challengeMap.json
- Update challenge map builder to store all superblocks and blocks as arrays - This allows tracking when a challenge appears across multiple superblocks/blocks - Update challengeMapUtils to use first array element as canonical for dashboard grouping - First occurrence becomes the primary certification/block for the student dashboard - Full association history preserved in allSuperblocks/allBlocks arrays for future use Resolves: Ability to know all superblock associations per challenge
…C Proper/sync tests to their feature PR
NewtonLC
left a comment
There was a problem hiding this comment.
I tested this out in a Windows environment and originally, upon running node scripts/build-challenge-map-graphql.mjs, there was an issue with the pathing of the challenge map. I updated the file path to use the fileURLToPath() function and it should now work on all machines!
Aside from that, this PR looks ready for review.
| 8. Run `npm run mock-fcc-data` | ||
| 9. Run `npx prisma studio` | ||
|
|
||
| ### Challenge map (FCC Proper) |
There was a problem hiding this comment.
Can you add some explanation about the purpose of the Challenge Map? Why does does Classroom App need it? How is it consumed/transformed?
| const name = mapEntry.name; | ||
| const certification = | ||
| mapEntry.certification || (mapEntry.superblocks || [])[0]; | ||
| const block = mapEntry.block || (mapEntry.blocks || [])[0]; |
There was a problem hiding this comment.
Why do we need to check for both cases mapEntry.certification AND mapEntry.superblocks? Are we not sure what the actual property name is? Is the property name sometimes "certification" and at other times "superblocks"? Same question for "block" vs. "blocks" -- is it sometimes one vs. the other?
| mapEntry.certification || (mapEntry.superblocks || [])[0]; | ||
| const block = mapEntry.block || (mapEntry.blocks || [])[0]; |
There was a problem hiding this comment.
2nd time this code is duplicated. Can we prevent the code duplication?
| mapEntry.certification || (mapEntry.superblocks || [])[0]; | ||
| const block = mapEntry.block || (mapEntry.blocks || [])[0]; |
There was a problem hiding this comment.
This code gets duplicated below. Is there a way to prevent the duplication of this code?
Checklist:
Update index.md)Summary
This PR extends the work merged in #574 by:
challengeMap.jsonand recommending a weekly refresh.challengeMap.json(when present) to validate that FCC Proper output is digestible by Classroom.Co-authored-by: Newton Chung <NewtonLC@users.noreply.github.com>
Why keep both synthetic and real-map tests?
Synthetic tests validate the transformation logic in isolation (stable, deterministic).
Real-map tests validate that the actual FCC Proper map format is compatible with Classroom. This is important since the upstream map can change over time.
This aligns with the feedback:
“Tests should run against the actual challengeMap.json from FCC Proper … If the file does not exist, the test should fail and tell the user to generate it.”
New real-map test descriptions
loads a non-empty challenge map
Confirms
challengeMap.jsonexists, parses, and has entries. Prevents downstream logic from running on empty or missing data.builds dashboard data using the first valid map entry
Verifies the map’s real structure can be transformed into the expected nested dashboard shape.
skips unknown challenge IDs
Ensures the logic ignores unknown/missing IDs safely (no crashes or mis-grouping).
resolves multiple students against the current map
Validates per-student transformation with real map data and the expected output shape.
Fail example (missing map):
Pass example (map generated):
Testing:
npm run test:challenge-mapTesting / CI Note
Local dev: If
challengeMap.jsonis missing, the real‑map suite fails with a clear error and guidance to run node scripts/build-challenge-map-graphql.mjs.CI: When CI=true and the map is missing, the real‑map suite is skipped to keep the pipeline green. Synthetic tests still run.