test : added unit tests for GoalTracker component#791
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
4d974ed to
66c7182
Compare
Closes Priyanshu-byte-coder#771 Added test/GoalTracker.test.ts covering: - handleCreate validation: title trim, empty/whitespace rejection, 100-char limit, valid submission - ConfettiBurst trigger: milestone completion at 100% (not 25/50/75%), progress percentage capped at 100% - getCompletionLabel: correct labels for one-time/weekly/monthly goals - DELETE confirmation: optimistic update, correct endpoint, failed DELETE rollback - RECURRENCE_LABELS: all three recurrence types mapped correctly Impact: All 24 tests pass. Goal creation validation and milestone detection validated.
…test for type checking
Closes #771.
Summary of What Has Been Done:
Added test/GoalTracker.test.ts with 24 vitest tests covering the GoalTracker component's data handling and validation logic.
Changes Made:
New file: test/GoalTracker.test.ts
Test coverage:
Impact it Made:
All 24 tests pass. Goal creation validation and milestone detection validated for the GoalTracker component.