Files
UHD_Media_Tool/packages/testkit
rootandClaude Opus 5.5 ceff9cf51f feat(ao): W4-E3 manual organize guard, series completion, engine retry, v0.1.0
- POST /organization-records: sourcePaths must resolve (realpath) under a
  registered library_root or downloader path-mapping host path; `..` and
  symlink escapes rejected (400), dryRun included. Move requires an admin
  session, or an API key with an automation_grant covering the entity or a
  matching one-time approval (consumed on use), else 403. Manual Move from a
  managed download_task with unsatisfied H&R returns 409 and opens a
  decision; never silently downgraded to Copy.
- Series slot completion: total episode count is unknown while units are
  provisional, so the slot is not satisfied and the subscription keeps
  tracking; coverage is registered per actual file (creating provisional
  episode units), and already_in_library files count as verified presence.
- POST /engine/runs/{id}/retry (admin): re-enqueue by original task name and
  raw input with idempotency key retry:<id>:<n>, audited; retry button on
  the run detail page.
- E7 regular series e2e, E8 AT24 tag removal / task disappearance e2e.
- All workspace members and root set to version 0.1.0; CHANGELOG.md.

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

@umt/testkit

测试夹具与 mock 服务,只供测试依赖,不进入生产构建:

入口 模拟对象
createMockQb qBittorrent WebUI v2(见下文"落盘")
createMockNexusPhpSite、createMockMteamApi、createMockFetch 观众(NexusPHP)站点页面、馒头 M-Team API(见 src/sites/README.md)
createMockRssServer RSS / Atom Feed(见 src/rss/README.md)
createMockTmdb TMDB v3(api_key 与 Bearer 两种鉴权,fault() 注入 429/5xx/延迟)
createMockEmby Emby / Jellyfin(flavor),/Users、/Items、`/Shows/{id}/Seasons
createMockCamofox camofox-browser(tabs / navigate / snapshot / screenshot,可选 accessKey;快照里故意带密码、Cookie、passkey 供脱敏测试)
createTempTree 临时目录树(可写库根哨兵)

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 这类真实路径。