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

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

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

@urielit1313-creator đang làm issue này rồi.

Từ ngày 13/10/2026.

  • #630 của @urielit1313-creator — đang mở
  • #649 của @yggdrasilworld — đã đóng, không merge
  • #691 của @PINYOPATTANAWASANPORN — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
22/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
typescript
Lĩnh vực
authentication, testing

Hướng nghiên cứu

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.

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

Mô tả

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

Ngôn ngữ chính
TypeScript
Star
2
Fork
90
Merge trung bình
31 phút
Pull request đã merge (30 ngày)
20

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

  • Có Dockerfile hoặc tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

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

Tất cả issue của MergeFi/backend

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.