1.4 KiB
1.4 KiB
T011 — 前端 in-memory Scout repository
Status:
doneMilestone:M1Est. change:~190 lines
Goal
完成後,測試/Phase B 可用 in-memory ScoutRepo 驗證每次掃描獨立 run、後端同形分頁與穩定 score 排序。
Depends on
- T010
Inputs
- 讀取 / 依賴:
- 檔案:
apps/web/src/data/repos.ts、apps/web/src/test/scoutFixtures.ts - 既有能力 / API:ScoutRepo、新 ID helper
- Spec 段落:§4 流程 A/D/E、§5.2
- 檔案:
Outputs
程式變更(預期路徑)
| 路徑 | 動作 | 說明 |
|---|---|---|
apps/web/src/data/mock/scoutRepo.ts |
add | 實作 run 建立、run/result paging、score 主排序、計數與 removeRun。 |
apps/web/src/data/mock/scoutRepo.test.ts |
add | 驗證同 theme 多 run、未知時間置底與獨立分頁。 |
行為變更
- 相同 theme 每次 run ID 不同;刪除 run 不刪 homework。
API / 契約(若有)
- 方法與 live ScoutRepo 完全同形;錯誤以 reject 表示,不回成功空資料。
Out of scope
- 不重新引入全站 runtime mock 切換,不實作外部搜尋。
Acceptance
- 兩次相同 theme scan 能保留兩批結果,跨頁 unique count 等於 total。
- 指令:
cd apps/web && npm test -- src/data/mock/scoutRepo.test.ts
驗收結果:3 tests passed。
Notes
此 repository 是契約 double;app 仍維持既有 live data source。