Files
UHD_Media_Tool/packages/testkit
rootandClaude Opus 5.5 fe9693d4ca refactor(ao): background loops only orchestrate; cleanup/reconcile endpoints enqueue
- separate qB sync timer from the planning timer
- threshold cleanup, reserved-plan and pending-import sweeps, 6h reconcile enqueue
  engine tasks with time-slot idempotency keys instead of running inline
- pending-import sweep selects by completed_at (sync refreshes updated_at every round)
- POST /download-cache/cleanup and /library/reconcile return {taskId, runId} (202);
  web jumps to the engine run page
- test: a 50MB verifyAndImport in progress does not delay qB sync

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 22:12:16 +08:00
..

@umt/testkit

测试夹具与 mock 服务:mock qB WebUI、mock NexusPHP 站点、mock M-Team API、mock RSS、mock TMDB 与临时目录夹具。只供测试依赖,不进入生产构建。

mock qB 落盘

createMockQb() 默认只改内存状态。e2e 需要"下载完成 → Copy 入库"时:

const qb = await createMockQb();
// files 的 path 相对任务 save_path(多文件种子含根目录);写随机内容,大小与清单一致,返回绝对路径
const paths = await qb.complete(hash, { files: [{ path: "Show.S01/Show.S01E01.mkv", size: 4 * 1024 * 1024 }] });
  • createMockQb({ materializeFiles: true }) 让所有 complete() 按现有文件清单落盘;单次总量上限 maxMaterializeBytes(默认 64 MiB)。
  • torrents/delete 带 deleteFiles=true 时同步删除落盘文件和因此变空的目录(不越过 save_path)。
  • save_path 请用临时目录(mkdtemp),不要用 /downloads 这类真实路径。