Skip to content

refactor(github): split getFullDashboardData into focused sub-functionsΒ #295

@JhaSourav07

Description

@JhaSourav07

🧩 Background

getFullDashboardData in lib/github.ts is ~120 lines handling profile mapping, language aggregation, developer score, insights, achievements, and commit clock β€” all in one function. This makes it hard to test or reuse individual parts.

🎯 Objective

Extract at least three pure helpers:

  • buildProfileData(profileData, totalStars, developerScore)
  • aggregateLanguages(repos)
  • buildInsights(streakStats, languages)

πŸ“ Files to touch

  • lib/github.ts

πŸ› οΈ Implementation steps

  • Extract each helper, keeping existing tests green.
  • Export helpers for unit-testability.
  • Add at least one focused test per helper in lib/github.test.ts.

βœ… Definition of done

  • getFullDashboardData is ≀60 lines.
  • Each helper is independently testable.
  • All existing tests pass.

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions