55 lines
1.3 KiB
Markdown
55 lines
1.3 KiB
Markdown
|
|
# T002 — Scout 頁面測試骨架
|
|||
|
|
|
|||
|
|
> Status: `done`
|
|||
|
|
> Milestone: `M0`
|
|||
|
|
> Est. change: `~160 test lines`
|
|||
|
|
|
|||
|
|
## Goal
|
|||
|
|
|
|||
|
|
完成後,Scout 頁面可用注入的 repository 與 job context 測試,不需真 API 或瀏覽器網路。
|
|||
|
|
|
|||
|
|
## Depends on
|
|||
|
|
|
|||
|
|
- —
|
|||
|
|
|
|||
|
|
## Inputs
|
|||
|
|
|
|||
|
|
- 讀取 / 依賴:
|
|||
|
|
- 檔案:`apps/web/src/pages/ScoutPage.tsx`、`apps/web/src/data/DataContext.tsx`
|
|||
|
|
- 既有能力 / API:React Testing Library、Vitest、`Repos` 介面
|
|||
|
|
- Spec 段落:§4 流程 D/E/F
|
|||
|
|
|
|||
|
|
## Outputs
|
|||
|
|
|
|||
|
|
### 程式變更(預期路徑)
|
|||
|
|
|
|||
|
|
| 路徑 | 動作 | 說明 |
|
|||
|
|
|------|------|------|
|
|||
|
|
| `apps/web/src/pages/ScoutPage.test.tsx` | add | 建立 renderer、fake repos、固定 job context 與基本載入案例。 |
|
|||
|
|
| `apps/web/src/test/scoutFixtures.ts` | add | 提供貼文、homework 與時間 fixtures。 |
|
|||
|
|
|
|||
|
|
### 行為變更
|
|||
|
|
|
|||
|
|
- 無產品行為變更;後續 UI tasks 共用同一測試骨架。
|
|||
|
|
|
|||
|
|
### API / 契約(若有)
|
|||
|
|
|
|||
|
|
- fake repository 的失敗不得被測試 helper 轉為成功空陣列。
|
|||
|
|
|
|||
|
|
## Out of scope
|
|||
|
|
|
|||
|
|
- 不在此 task 改 Scout UI 或 repository 介面。
|
|||
|
|
|
|||
|
|
## Acceptance
|
|||
|
|
|
|||
|
|
- [ ] 能驗證 loading、成功與錯誤三種基線狀態。
|
|||
|
|
- [ ] 指令:
|
|||
|
|
|
|||
|
|
```bash
|
|||
|
|
cd apps/web && npm test -- src/pages/ScoutPage.test.tsx
|
|||
|
|
```
|
|||
|
|
|
|||
|
|
## Notes
|
|||
|
|
|
|||
|
|
若既有 context 難以注入,只做最小測試 seam,不建立第二套 app data flow。
|