[CLAUDE] Docs: chốt session 5 — Budget FE + PE feature complete + Tests Phase 1-2 + CI gate
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Failing after 22s
Some checks failed
Deploy SOLUTION_ERP / build-deploy (push) Failing after 22s
Session 5 (29/04) — 6 commit feature + 1 chốt MD này. ==== Stats sau session 5 ==== - 52 DB tables (+1 PEDeptOpinions) - 15 migrations (+`AddPurchaseEvaluationDepartmentOpinions`) - ~128 API endpoints (+4) - ~31 FE pages (+5 Budget + 1 PeWorkflowsPage) - 71 unit test pass (54 Domain + 17 Infra) — CI gate live, fail → no deploy - ~13050 BE LOC (+1300) - 30 demo user, 38 gotchas, 6 skill (no change) ==== MD touched ==== - STATUS.md: header Phase 8 + 6 row Recently Done session 5 + cumulative cột S5 + In Progress S6 (Hard blockers + Optional polish + Tests Phase 3-5 + Ops) - HANDOFF.md: TL;DR 6 milestone S5 + Cảnh báo S6 (CI test gate workflow mới) + Priority 0 S6 (UAT + Ops focus) + Phase status table cập nhật - migration-todos.md: Phase 8 done với A/B/C/D/E (FE Budget / PE-HD integration / PE WF Designer / Ý kiến 4 PB / Tests Phase 1-2) + Phase 9 active (UAT + Ops + carry over) - architecture.md: §11 Testing strategy mới (test pyramid bottom-heavy + stack + CI gate + phased priority + quy tắc bổ sung mỗi feature) - database/schema-diagram.md: Migration 15 row + total 52 tables + §13 PE Department Opinion (1 bảng UNIQUE PEId+Kind + Upsert behavior + SQL DDL) - ef-core-migration SKILL: migration 15 entry + 52 tables total + Phase 8 update note - CLAUDE.md (root): modules table + Tests row + scope `Tests` + Tests section mới + count update 15/52 - docs/CLAUDE.md: 7 module bullet + ERD 52 bảng + Roadmap Phase 8 done + Phase 9 active S6 - memory project_solution_erp.md: Phase 8 summary + Session 6 priority + workflow user mới (dotnet test → commit → push) - session log 2026-04-29-chot-session-5-budget-fe-pe-tests.md (NEW — 10+ section detail) ==== Verify ==== - dotnet test SolutionErp.slnx → 71 pass / 2s - git status clean sau commit này Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@ -309,7 +309,59 @@ DangSoanThao(1) ──Trình──► ChoCCM(2) ──Duyệt──► ChoCEO(3)
|
||||
|
||||
Chi tiết: [`database/schema-diagram.md §12`](database/schema-diagram.md).
|
||||
|
||||
## 11. Liên quan
|
||||
## 11. Testing strategy (Phase 8 — Session 5)
|
||||
|
||||
Test pyramid bottom-heavy, **không E2E** (brittle, maintenance cao cho solo dev).
|
||||
|
||||
```
|
||||
┌──────────────────────────────────┐ ❌ Skip
|
||||
│ E2E / UI (Playwright) │ Brittle, slow, tốn time maintain
|
||||
├──────────────────────────────────┤ ⚠️ TODO Phase 4
|
||||
│ API smoke (WebApplicationFactory)│ 1-2 happy path roundtrip per critical endpoint
|
||||
├──────────────────────────────────┤ ⚠️ TODO Phase 3
|
||||
│ Application Handler (CQRS) │ EF InMemory cho business rules
|
||||
├──────────────────────────────────┤ ✅ Done Phase 2 — 17 test
|
||||
│ Infrastructure (SQLite in-mem) │ Code generator format + sequence + year boundary
|
||||
├──────────────────────────────────┤ ✅ Done Phase 1 — 54 test
|
||||
│ Domain Policy (pure functions) │ State machine + role transition + Registry mapping
|
||||
└──────────────────────────────────┘
|
||||
```
|
||||
|
||||
**Stack:**
|
||||
|
||||
| Layer | Framework | Note |
|
||||
|---|---|---|
|
||||
| .NET test | xUnit 2.9.3 | Industry standard |
|
||||
| Assertion | FluentAssertions 7.2 | Pin trước v8 commercial license |
|
||||
| EF testing | Microsoft.EntityFrameworkCore.Sqlite 10 | Phase 2+ — supports transactions |
|
||||
| Test fixture | Custom `SqliteDbFixture` + `TestApplicationDbContext` | Override `nvarchar(max) → TEXT` cho SQLite compat |
|
||||
|
||||
**CI gate:** `.gitea/workflows/deploy.yml` chạy `dotnet test` cho từng test project TRƯỚC build/publish/deploy. Test fail → `exit $LASTEXITCODE` → no deploy.
|
||||
|
||||
```yaml
|
||||
- name: Run unit tests (Domain)
|
||||
run: dotnet test tests/SolutionErp.Domain.Tests/...
|
||||
|
||||
- name: Run integration tests (Infrastructure)
|
||||
run: dotnet test tests/SolutionErp.Infrastructure.Tests/...
|
||||
```
|
||||
|
||||
**Phase priority — anti-overkill:**
|
||||
|
||||
1. **Phase 1 (Done)** — Domain policy: 3 test file (Contract WF / PE WF / Budget) cover transition rules + Registry + FromDefinition. ~54 test, < 7s.
|
||||
2. **Phase 2 (Done)** — Infra code generator: format RG-001/PE + sequence increment + year boundary (framework HĐ). ~17 test, ~2s.
|
||||
3. **Phase 3 (Pending)** — Application CQRS handler: critical state-change handlers (Transition + Create) với EF InMemory.
|
||||
4. **Phase 4 (Pending)** — API smoke: WebApplicationFactory + SQLite, 5-7 endpoint critical roundtrip.
|
||||
5. **Phase 5 (Pending)** — FE Vitest cho lib utility (queryMatches, fmtMoney) — chỉ pure functions, KHÔNG component snapshot.
|
||||
|
||||
**Quy tắc bổ sung mỗi feature mới:**
|
||||
- Domain policy method → 2-3 test (positive + negative + edge)
|
||||
- CQRS handler có guard → 1 test mỗi guard branch
|
||||
- Bug found in production → 1 regression test added before merge
|
||||
|
||||
Detail run: `dotnet test SolutionErp.slnx` chạy cả 71 test ~2s.
|
||||
|
||||
## 12. Liên quan
|
||||
|
||||
- [`rules.md`](rules.md) — coding conventions
|
||||
- [`database/database-guide.md`](database/database-guide.md) — DB schema chi tiết
|
||||
|
||||
Reference in New Issue
Block a user