Summary of What Needs to be Done:
Add unit tests for the goal-tracker.ts utility module covering submitGoalWithRefresh function.
Changes that Need to be Made:
- Create test/goal-tracker.test.ts
- Add tests for successful goal creation with commits/prs unit (calls handleSync)
- Add tests for successful goal creation with other units (calls loadGoals)
- Add tests for fetch failure (returns created=false with generic error)
- Add tests for non-ok response with custom error message from JSON
- Add tests for non-ok response without custom error (falls back to generic message)
- Add tests for handleSync throwing (returns created=true with partial error)
- Add tests for loadGoals throwing (returns created=true with partial error)
- Add tests for POST payload construction
Impact that it would Provide:
Increases test coverage and ensures goal submission handles all error cases gracefully.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.
Summary of What Needs to be Done:
Add unit tests for the goal-tracker.ts utility module covering submitGoalWithRefresh function.
Changes that Need to be Made:
Impact that it would Provide:
Increases test coverage and ensures goal submission handles all error cases gracefully.
Hello @Priyanshu-byte-coder, please assign this issue to me (@tmdeveloper007) so I can open a focused PR.