Skip to content

test : added unit tests for goal-tracker.ts#2868

Open
tmdeveloper007 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2863
Open

test : added unit tests for goal-tracker.ts#2868
tmdeveloper007 wants to merge 1 commit into
Priyanshu-byte-coder:mainfrom
tmdeveloper007:#2863

Conversation

@tmdeveloper007

Copy link
Copy Markdown
Contributor

Closes #2863.

Summary of What Has Been Done:
Added a comprehensive test suite for the goal-tracker.ts utility module covering submitGoalWithRefresh function using mockable fetch.

Changes Made:

  • Created test/goal-tracker.test.ts with 10 test cases
  • Tested successful goal creation with commits unit (calls handleSync)
  • Tested successful goal creation with prs unit (calls handleSync)
  • Tested successful goal creation with other units (calls loadGoals)
  • Tested fetch failure returns created=false with generic error
  • Tested non-ok response with custom error from JSON
  • Tested non-ok response without custom error (falls back to generic message)
  • Tested handleSync throwing returns created=true with partial error
  • Tested loadGoals throwing returns created=true with partial error
  • Tested POST payload construction

Impact it Made:
Increases test coverage and ensures goal submission handles all error cases gracefully with proper user-facing messages.

@github-actions github-actions Bot added gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts) labels Jun 27, 2026
@github-actions

Copy link
Copy Markdown

GSSoC Label Checklist 🏷️

@Priyanshu-byte-coder — please apply the appropriate labels before merging:

Difficulty (pick one):

  • level:beginner — 20 pts
  • level:intermediate — 35 pts
  • level:advanced — 55 pts
  • level:critical — 80 pts

Quality (optional):

  • quality:clean — ×1.2 multiplier
  • quality:exceptional — ×1.5 multiplier

Validation (required to score):

  • gssoc:approved — counts for points
  • gssoc:invalid / gssoc:spam / gssoc:ai-slop — does not score

Type labels (type:*) are auto-detected from files and title. Review and adjust if needed.
Points formula: (difficulty × quality_multiplier) + type_bonus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc26 GSSoC 2026 contribution type:testing GSSoC type bonus: tests (+10 pts)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

test : add unit tests for goal-tracker.ts

1 participant