Skip to content

Add unit tests for CompleteWorkspaceMembers fallback chain #43

@rbansal42

Description

@rbansal42

Context

From code review of completion follow-up PR.

Problem

CompleteWorkspaceMembers has a 3-level fallback chain (Nickname → Username → DisplayName) in internal/cmdutil/completion.go:251-257, but there are no tests exercising this logic.

Suggested Fix

Extract the name-resolution logic into a pure function like resolveMemberName(user *api.User) string and add table-driven tests covering:

  • All fields present (should use Nickname)
  • Nickname empty (should use Username)
  • Nickname and Username empty (should use DisplayName)
  • All empty (should skip the member)

Files

  • internal/cmdutil/completion.go
  • internal/cmdutil/completion_test.go

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