Skip to content

Add missing test coverage for filters, Update handlers, time utilities, and cache concurrency #104

@joshuacrass

Description

@joshuacrass

Problem:
Current test coverage is limited to the data layer: cache, config, dashboard row building, branch name derivation, check summarization, truncation, JSON parsing, and markdown rendering. Zero BubbleTea Update()/View() logic is tested. Several utility functions and all filter resolution functions are untested.

Solution:
Add the following specific tests:

Filter resolution:

  • TestResolveIssueFilters_ResetactionChoice="reset" returns defaults
  • TestResolveIssueFilters_CustomAssigneechoice="custom" uses AssigneeCustom value
  • TestResolvePRFilters_DraftTrue / TestResolvePRFilters_DraftFalse — draft filter correctly mapped

Utilities:

  • TestIsMeAssigned — empty login returns false; login present in list returns true
  • TestTimeAgo — table-driven: past minute, hour, day, week, month, year; future timestamp; empty string; invalid string
  • TestDeriveBranchName_Unicode — titles with accented characters, emoji, CJK

BubbleTea Update handlers:

  • TestAppModel_Update_SwitchTab — dispatching switchTabMsg changes activeTab correctly
  • TestIssuesModel_Update_KeyRefreshr key sets loading=true and returns a fetch command
  • TestIssuesModel_Update_FetchError — error msg sets m.err; subsequent refresh clears m.err

Concurrency:

  • TestSaveCacheConcurrent — two goroutines call saveCache simultaneously; file is valid JSON afterward; no panic; go test -race passes

Acceptance Criteria:

  • All tests listed above are implemented and pass
  • go test -race ./... passes
  • Test coverage of internal/github filter logic increases measurably

Metadata

Metadata

Assignees

No one assigned

    Labels

    effort:5Large effort (1-2 days)priority:mediumMedium priority - fix when possibletype:enhancementEnhancement to existing feature

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions