Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Test the live updates stream (/api/events)

Aperta Adatta ai principianti
#16 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Funzionalità
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
node.js, typescript
Ambito
backend, testing

Direzione di ricerca

Leggi apps/api/src/routes.ts per broadcast() e la route /api/events, poi esamina la classe Client e i modelli di test API esistenti in tests/api.test.mjs. Aggiungi test per l’accesso non autenticato, gli aggiornamenti degli incident e il salvataggio dei playbook. Leggi ogni stream con un reader e annullalo affinché npm test termini. Il lavoro è completato quando vengono verificati i tipi di evento previsti e l’id dell’incident e npm test termina con successo.

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

Descrizione

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

Lingua principale
TypeScript
Stelle
0
Fork
1
Merge medio
1h 11m
PR unite (30g)
13

Preparare l'ambiente

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.

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.