test/users.e2e-spec.ts expects 403 for an unauthenticated request, but JwtAuthGuard returns 401

Aperta
#612 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

@urielit1313-creator ci sta già lavorando.

Dal 13/10/2026.

  • #630 di @urielit1313-creator — aperta
  • #649 di @yggdrasilworld — chiusa senza merge
  • #691 di @PINYOPATTANAWASANPORN — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
22/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Ferma
Stack tecnologico
typescript

Direzione di ricerca

Start in test/users.e2e-spec.ts, where both tests call GET /users and GET /users/:id without a token and expect 403, then check how JwtAuthGuard is wired in for those routes. Three open pull requests (#630, #649, #691) are already linked, so review them before writing anything. Done means an unauthenticated request gets 401 through the real guard and a valid token for a non-permitted action gets 403.

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

Descrizione

good first issue testing

Problem

Both tests in test/users.e2e-spec.ts ("should return 403 when the guard denies the request") call GET /users and GET /users/:id with no token and expect 403. Unauthenticated requests through Nest's AuthGuard('jwt') get 401. The tests only pass if the guard is overridden. The renamed titles (after #136) hide that real unauthenticated behaviour isn't tested.

Suggested fix

Test the real guard: no token → 401, and a valid token for a non-permitted action → 403.

Related: #136

Lingua principale
TypeScript
Stelle
2
Fork
90
Merge medio
31m
PR unite (30g)
20

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Nessun modello di pull request
  • Nessuna guida per i contributori

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 MergeFi/backend

Tutte le issue di MergeFi/backend

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.