Component tests for AccountToggle

Aperta
#3,780 5 commenti 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@sam-zc ci sta già lavorando.

Dal 27/11/2026.

Valutazione

Difficoltà
3/5
Tempo stimato
Mezza giornata
Idoneità per principianti
78/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript
Ambito
frontend, testing

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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
Lingua principale
TypeScript
Stelle
246
Fork
436
Merge medio
9h 33m
PR unite (30g)
213

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Priyanshu-byte-coder/devtrack

Tutte le issue di Priyanshu-byte-coder/devtrack

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.