Component tests for AccountToggle

Đang mở
#3,780 5 bình luận 0 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@sam-zc đang làm issue này rồi.

Từ ngày 27/11/2026.

Đánh giá

Độ khó
3/5
Thời gian dự kiến
Nửa ngày
Mức phù hợp với người mới
78/100
Loại issue
Tính năng
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
react, typescript
Lĩnh vực
frontend, testing

Hướng nghiên cứu

The component under test is src/components/AccountToggle.tsx, and the closest patterns are test/components/PRMetrics.test.tsx and DiffTrendChart.test.tsx. Read how those mount components and mock fetch with vi.fn(), then cover the loading, error (/api/accounts and /api/user/orgs failing), empty, main-content and interaction states. Done means a new test/components/AccountToggle.test.tsx passes with queries by role or label, not CSS classes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

good first issue level 1 level:beginner status:assigned type:testing
Summary

src/components/AccountToggle.tsx (186 lines) has no component tests.

What to test
  • loading state while the request is pending
  • error state when /api/accounts, /api/user/orgs fails
  • empty state when the API returns no data
  • the main rendered content with realistic props / mocked data
  • the main interactions (clicks, inputs) and what they change
How

Use React Testing Library like the tests in test/components/ (e.g. PRMetrics.test.tsx, DiffTrendChart.test.tsx). Mock fetch with vi.fn(); no real network.

Acceptance criteria
  • New file test/components/AccountToggle.test.tsx
  • Each case above covered; tests query by role/label, not CSS classes
Ngôn ngữ chính
TypeScript
Star
246
Fork
436
Merge trung bình
9 giờ 33 phút
Pull request đã merge (30 ngày)
213

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của Priyanshu-byte-coder/devtrack

Tất cả issue của Priyanshu-byte-coder/devtrack

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.