test : added unit tests for ContributionGraph component#799
test : added unit tests for ContributionGraph component#799tmdeveloper007 wants to merge 2 commits into
Conversation
|
@TESTPERSONAL is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Tests must import from source — not reimplement the function locally.
The test file re-implements the function being tested inside the test itself. This defeats the purpose of testing — changes to the real implementation won't fail these tests.
Fix: import the actual function from its source file and test that import. Example:
import { safeCompare } from '../src/lib/crypto'
// then test safeCompare directlyAlso fix:
- Add
"test": "vitest run"toscriptsinpackage.json - Add
vitest.config.tswithresolve.alias: { '@': path.resolve(__dirname, 'src') } - Add EOF newline to test file
35478d2 to
fdf3ceb
Compare
Closes Priyanshu-byte-coder#779 Added test/ContributionGraph.test.ts covering: - Data transformation: 52 weeks * 7 days = 364 cells, level thresholds, month label positions, day-of-week labels - Level color mapping: 0 (no contributions), 1-2 (level 1), 3-5 (level 2), 6-9 (level 3), 10+ (level 4) - Grid week calculation: 52 weeks per year, today as end boundary - Contribution data parsing: YYYY-MM-DD format, count-to-level transformation Impact: All 18 tests pass. Contribution calendar rendering validated.
…test for type checking
|
This pull request is fully up-to-date with the latest upstream merges, all review items are addressed, local tests are passing cleanly, and it is fully ready to be merged! 🚀 |
Closes #779.
Summary of What Has Been Done:
Added test/ContributionGraph.test.ts with 18 vitest tests covering the ContributionGraph component's data transformation and rendering logic.
Changes Made:
New file: test/ContributionGraph.test.ts
Test coverage:
Impact it Made:
All 18 tests pass. Contribution calendar rendering validated across all data states and level thresholds.