Commit a4740e0
authored
test(github): verify fetchUserRepos returns correct star count for a single repo (JhaSourav07#1692)
## Description
Fixes JhaSourav07#684
Program: GSSoC 2026
This PR introduces robust unit test coverage for the `fetchUserRepos`
utility function within our GitHub GraphQL/REST client integration
layer.
Previously, tests verified only the first item in a minimal layout. This
update implements deep structural verification across a varied dataset
array.
### Changes Made
* Added 1 comprehensive test case in `lib/github.test.ts` mocking
network responses via global `fetch`.
* Structured a mock array payload containing 3 mock repositories with
distinct star weights and languages.
* Added 3 core assertions validating length accuracy, property presence
(`stargazers_count` & `language`), and data mapping parity.
### Why this matters
Ensures the repository parsing logic remains functional and correctly
handles multiple project entries, protecting against broken metric
calculations and rendering glitches across internal user dashboard
modules.
---
## Pillar
- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Bug fix, refactoring, docs)
---
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally (`npm run test
lib/github.test.ts`).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [x] I have starred the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [ ] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- [ ] (Recommended) I joined the CommitPulse Discord server for faster
collaboration, mentorship, and PR support.1 file changed
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
456 | 456 | | |
457 | 457 | | |
458 | 458 | | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
459 | 480 | | |
460 | 481 | | |
461 | 482 | | |
| |||
0 commit comments