Skip to content

test : add unit tests for goal-tracker.ts #2863

Description

@tmdeveloper007

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions