Skip to content

[Testing]: Write unit tests for core UI components with Vitest and Testing Library #954

@Muneerali199

Description

@Muneerali199

Description

Most UI components lack test coverage. We need unit tests for the most commonly used shared components to prevent regressions during refactoring.

Goals

  • Set up Vitest as the test runner (it's already in devDependencies)
  • Configure @testing-library/react with Vitest
  • Write tests for 8+ shared components:
    • components/ui/button.tsx
    • components/ui/dialog.tsx
    • components/ui/dropdown-menu.tsx
    • components/ui/tabs.tsx
    • components/ui/alert.tsx
    • components/ui/badge.tsx
    • components/ui/toast.tsx
    • components/ui/skeleton.tsx
  • Test rendering, user interactions, accessibility attributes
  • Add test to workflow (CI)

Files

  • __tests__/components/ui/button.test.tsx (new)
  • __tests__/components/ui/dialog.test.tsx (new)
  • __tests__/components/ui/dropdown-menu.test.tsx (new)
  • __tests__/components/ui/tabs.test.tsx (new)
  • vitest.config.ts (new, if not existing)

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions