Skip to content

chore: add unit tests for cmdutil shared utilities #31

@rbansal42

Description

@rbansal42

The new shared utilities in internal/cmdutil/ (time.go, user.go, output.go, strings.go) have no unit tests. These are pure functions used by 17+ call sites — a regression here cascades everywhere.

Needed tests:

  • TimeAgo: zero time, past, future, boundary values (1 min, 1 hour, 1 day, 1 month, 1 year)
  • TimeAgoFromString: empty, RFC3339, Bitbucket microsecond format, invalid
  • GetUserDisplayName: nil, empty fields, full fields, nickname-only
  • TruncateString: short, exact, over limit, with newlines
  • PrintJSON: valid struct, error case
  • ConfirmPrompt: y, yes, Y, YES, no, empty, EOF
  • PrintTableHeader: color enabled vs disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions