refactor(homeview): extract formatDesc into testable functions #167
No reviewers
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
thwap/steeper!167
Loading…
Reference in a new issue
No description provided.
Delete branch "refactor/165-extract-formatdesc"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Extract
formatDesc,opTypeLabel,activityColor, andtimeAgofrom closures insideHomeView.renderActivities()into package-level functions so they can be unit tested.Adds
homeview_test.gowith 46 table-driven subtests covering:Why
Closes #165. The closures were impossible to unit test. The refactored functions are simple, stateless, and fully covered.
Testing
go build ./...passesgo test ./...passesBreaking Changes
None — pure refactor, no behavior changes.
Closes #165
Review
Result: Approved — no blocking issues. Closes #165.
Summary: Pure refactor — extracts 4 closures to package-level functions with zero behavior change. Adds 46 table-driven subtests coverting opTypeLabel, timeAgo, and formatActivityDesc across known types, edge cases, and fallback paths. Tests pass, build passes.
Checklist:
50b1c7f8e99ede7e1670New commits pushed, approval review dismissed automatically according to repository settings
Re-Review
Result: Approved — no blocking issues.
Changes since previous review:
TestActivityColor(20 cases) — covers all known op types + defaultTestFormatActivityDesc— covers first commit, push, head commit fallback, and malformed JSONMinor (non-blocking): Test name
"commit_repo returns empty on malformed payload"is misleading — expected value is"not json"(raw content fallback), not empty string. Consider renaming to"commit_repo falls back to content on malformed payload".Updated checklist: