Set up unit tests for the web app (Vitest) with a first test

Aperta
#108 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
react, typescript, vite

Direzione di ricerca

Start with apps/web/package.json and apps/web/vite.config.ts to see how the web app is built, then the root package.json and the .github/workflows files to see how npm test runs in CI. The timeAgo helper is defined in apps/web/src/components/PostCard.tsx and may be moved to apps/web/src/lib. Done means Vitest is configured in apps/web, root npm test runs both web and API suites locally and in CI, and a first timeAgo test covering seconds, minutes, hours, days and a future date passes.

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

Descrizione

help wanted tests web

The API has a Vitest suite, but apps/web has no unit-test setup, so helpers such as timeAgo are untested.

What to do

Add Vitest (and Testing Library if you need it) to apps/web, a test script, and make the root npm test run it. Add a first test file for timeAgo in apps/web/src/components/PostCard.tsx (seconds, minutes, hours, days, and a future date). Move timeAgo into apps/web/src/lib if that keeps the test simple.

Where to look

apps/web/package.json, apps/web/vite.config.ts, root package.json, .github/workflows.

Done when

npm test runs web and API tests locally and in CI, and the first test passes.

How to work on it

Fork the repo, branch from main, and follow CONTRIBUTING.md. Run npm run typecheck, npm test and npm run lint before opening a PR. Comment here if you'd like to take it, and ask if anything is unclear.


Generated by Claude Code

Lingua principale
TypeScript
Stelle
6
Fork
6
Merge medio
1h 59m
PR unite (30g)
59

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

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 Haseeb-MernStack/commune

Tutte le issue di Haseeb-MernStack/commune

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.