Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Test the live updates stream (/api/events)

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

Chưa có ai nhận issue này.

Đá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
86/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ệ
node.js, typescript
Lĩnh vực
backend, testing

Hướng nghiên cứu

Đọc apps/api/src/routes.ts để tìm broadcast() và route /api/events, sau đó kiểm tra lớp Client và các mẫu kiểm thử API hiện có trong tests/api.test.mjs. Bổ sung kiểm thử cho truy cập chưa xác thực, cập nhật incident và lưu playbook. Đọc từng luồng bằng reader rồi hủy để npm test kết thúc. Công việc hoàn tất khi các loại sự kiện mong đợi và incident id được xác nhận, đồng thời npm test chạy thành công.

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

Mô tả

good first issue help wanted
The task

When someone changes a playbook or an incident, everyone sees it live: the browser keeps GET /api/events open, a Server-Sent Events stream, and the server pushes an event on every change. Nothing tests this stream. Add a test, so that a change to the server cannot silently stop live updates.

Where to look
  • apps/api/src/routes.ts: broadcast() near the top writes event: change with { type, id } as data; the /api/events route needs a signed-in user (role viewer)
  • tests/api.test.mjs: the Client class keeps the session cookie. fetch can read a stream: read res.body with a reader and split the text on blank lines (\n\n), each block is one event

Cancel the reader at the end of the test, or the test run will not exit.

Done when
  • Opening /api/events without a session gets 401
  • With a session, after an analyst changes an incident (for example its name, POST /api/incidents/:id/meta), an event: change arrives with type incident and the incident's id
  • After an editor saves a playbook draft, an event arrives with type playbook
  • npm test passes, and exits on its own
Mentor

@0b3l1X-SolidGeeks

Ngôn ngữ chính
TypeScript
Star
0
Fork
1
Merge trung bình
1 giờ 11 phút
Pull request đã merge (30 ngày)
13

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 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.