Skip to content

Conversation

VetteIT
Copy link

@VetteIT VetteIT commented Sep 27, 2025

Description

Adds a comprehensive unit test suite for the TeamMemberCard component using Vitest + React Testing Library.
Tests are co-located next to the component and focus on behavior (not styles), including avatar rendering/fallback, GitHub link attributes, role chip labeling, and click behavior for roles with/without links.

Closes #116


What change does this PR introduce?

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • CI/CD (updates related to the CI/CD process)
  • Chore (miscellaneous tasks that do not fall into the above options)

What is the proposed approach?

  • Testing strategy: Vitest + React Testing Library with co-located tests.
  • Mocks:
    • react-i18next mocked to return default strings for stability.
    • useIsDesktop mocked to validate both desktop and mobile code paths.
  • Behavior covered:
    • Renders avatar <img> when avatarUrl is provided; hides <img> on onError (fallback behavior).
    • Falls back to icon when avatarUrl is absent.
    • Displays member name.
    • Renders GitHub link with correct href, target="_blank", and rel="noopener noreferrer".
    • Renders role chips:
      • Two-line label when project is present.
      • Single-line label when project is absent.
    • Clicking a role with link calls window.open(link); clicking a role without link is a no-op.
    • Supports multiple roles.
  • Scope: Tests only; no production code changes.

Checklist:

  • The commit message follows our adopted guidelines
  • Testing has been done for the change(s) added (for bug fixes/features)
  • Relevant comments/docs have been added/updated (for bug fixes/features)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] Add unit test cases for TeamMemberCard component
1 participant