Handler tests for stop/pause/resume branches that only a live capture reaches

Aperta
#348 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à
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
65/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
typescript
Ambito
desktop, testing

Direzione di ricerca

Read src/tools/stopRecording.ts, src/tools/pauseRecording.ts, and src/tools/resumeRecording.ts, then follow the fake-spawn harness in src/__tests__/startRecording.test.ts. Add handler-level tests for the listed arm, ended-session, ownership, webcam, pause, and resume cases; run npm test and confirm the tests cover those branches and the src/tools/** coverage floor passes.

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

Descrizione

effort: medium help wanted priority: medium testing

Summary

stop_recording, pause_recording and resume_recording contain branches of their own beyond utils/lifecycle.ts: arm-id routing, the already-ended path that finishes a leftover replay buffer and picks a note by endReason, the foreign-owner refusal, webcamReport, and the "Already paused" / "Already recording" short-circuits. Only the Windows capture smoke and opt-in local tests call these tools, and the smoke is the flaky one (#331). Local coverage without the smoke: stopRecording.ts 30.6% lines / 19.2% branches, pauseRecording.ts 16.7% / 0%, resumeRecording.ts 15.4% / 0%. The src/tools/** 77% floor fails locally (76.3%).

Where

  • src/tools/stopRecording.ts:25-54, 86-128
  • src/tools/pauseRecording.ts:27-35, src/tools/resumeRecording.ts:27-35
  • src/__tests__/captureSmoke.test.ts:19 (gated by RUN_CAPTURE_SMOKE)

Suggested fix

Add a handler-level test file that reuses the fake-spawn harness in src/__tests__/startRecording.test.ts:23-58 (seeded SessionStore, InMemoryTransport client). Cases:

  • stop_recording with a waiting arm- id: status "cancelled", note "Disarmed", and the arm is gone.
  • stop_recording with an unknown arm- id: isError "No armed recording".
  • stop_recording with an arm whose start failed: status "failed" plus error.
  • stop_recording with an arm that started: stops the arm's sessionId.
  • stop_recording on a stopped session with endReason max_duration / window_closed / undefined: the three notes, and no kill.
  • stop_recording on an ended session with a replay dir: save:false gives replay.discarded; save:true with a failing save gives replay.error.
  • stop_recording on a live record owned by another live pid: the foreignStopRefusal error, and the process is not killed.
  • webcam report: missing file gives webcam.error; probe-able files give overlay.
  • pause_recording on an already paused session: "Already paused."; unknown id gives isError.
  • resume_recording on a recording session: "Already recording."; the result carries remainingSec only when capSec > 0.

Getting started

  • Relevant files: src/tools/stopRecording.ts, src/__tests__/startRecording.test.ts
  • How to run tests: npm test

Filed by repo-audit/full-audit at b9b94fa. Severity: medium. Effort: M. audit-key: testing|src/tools/stopRecording.ts|register

Lingua principale
TypeScript
Stelle
1
Fork
4
Merge medio
14h 8m
PR unite (30g)
48

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.

Altre issue di TMHSDigital/screencast-mcp

Tutte le issue di TMHSDigital/screencast-mcp

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.