Test the live updates stream (/api/events)
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
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
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 writesevent: changewith{ type, id }as data; the/api/eventsroute needs a signed-in user (roleviewer)tests/api.test.mjs: theClientclass keeps the session cookie.fetchcan read a stream: readres.bodywith 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/eventswithout a session gets401 - With a session, after an analyst changes an incident (for example its name,
POST /api/incidents/:id/meta), anevent: changearrives withtypeincidentand the incident'sid - After an editor saves a playbook draft, an event arrives with
typeplaybook -
npm testpasses, 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
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Issue simili
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
scaleway/ultraviolet#7089 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
tencent-connect/dsh-qqbot#81 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: Pen taps on sidebar rows start a drag and lose their clickForse già presa @makhnatkin l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
clangd/vscode-clangd#1009 ·