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ở
#8 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ó
3/5
Thời gian dự kiến
1-2 ngày
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ệ
javascript, node.js
Lĩnh vực
backend, testing

Hướng nghiên cứu

Read the /api/events route in server/server.js and the existing tests and Client class in tests/api.test.mjs. Add coverage for unauthenticated access, the initial change event and revision, updates after a write, and the proposals event. Run npm test; cancel the stream reader so the test process exits.

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 the map, the others see 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
  • server/server.js: the /api/events route (around line 359) sends event: change with the current rev as soon as it opens; commitChanges() then broadcasts change with the new rev after every write, and saveProposals() broadcasts proposals
  • tests/api.test.mjs: the existing tests and the Client class. 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

Close the stream at the end of the test (cancel the reader), or the test run will not exit.

Done when
  • Opening /api/events without credentials gets 401
  • With credentials, the first event is change with the current rev
  • After a write (PUT /api/si/... as an approver), a change event arrives with rev + 1
  • Creating a proposal sends a proposals event
  • npm test passes, and exits on its own
Mentor

@0b3l1X-SolidGeeks

Ngôn ngữ chính
JavaScript
Star
0
Fork
1
Merge trung bình
2 phút
Pull request đã merge (30 ngày)
6

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 SolidGeeks/strata

Tất cả issue của SolidGeeks/strata

Issue tương tự

Thêm issue về JavaScript

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.