Add route tests for /api/webhooks/custom/[id]

Đang mở Phù hợp với người mới
#3,718 7 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

@priyanshiy1312-ui đang làm issue này rồi.

Từ ngày 28/11/2026.

Đá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
85/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ệ
nextjs, supabase, typescript
Lĩnh vực
api, testing

Hướng nghiên cứu

Bắt đầu với các handler GET, PATCH và DELETE trong src/app/api/webhooks/custom/[id]/route.ts, sau đó sao chép cấu hình mock từ test/goals-crud.test.ts và test/diff-trend-route.test.ts. Tạo test/api-webhooks-custom-id-route.test.ts, mock các module session, Supabase và GitHub bằng vi.mock, rồi gọi các handler với một NextRequest. Hoàn thành khi bốn trường hợp được liệt kê đều pass dưới pnpm test mà không có lệnh gọi mạng hoặc cơ sở dữ liệu thật.

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

Mô tả

level 2 level:intermediate status:assigned type:testing
Summary

src/app/api/webhooks/custom/[id]/route.ts (201 lines, handles GET, PATCH, DELETE) has no tests.

What to test
  • returns 401 when there is no session
  • returns the right error status when the Supabase call fails (mock it to return { error })
  • returns 400 for a malformed or invalid body
  • the happy path: correct status and response shape
How

Import the handler directly and call it with a NextRequest, mocking the session, Supabase and GitHub modules with vi.mock. test/goals-crud.test.ts and test/diff-trend-route.test.ts are good examples to copy from. No real network or database calls.

Acceptance criteria
  • New file test/api-webhooks-custom-id-route.test.ts
  • Every case above is covered and pnpm test passes
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.