7e8f4859cd
- Add ADR-036 unified OCR architecture (typhoon-ocr via Ollama) - Extend AI execution profiles for OCR sandbox configuration - Add comprehensive frontend test coverage (components, hooks, services) - Add backend test coverage for document-numbering services - Update OCR sidecar with typhoon-ocr integration - Add AI policy service and execution profile management - Update AGENTS.md and architecture documentation
// File: frontend/tests/README.md // Change Log // - 2026-06-13: Document frontend unit test naming and header conventions.
Frontend Test Conventions
ใช้ไฟล์ *.test.ts หรือ *.test.tsx เท่านั้น เพราะ frontend/vitest.config.ts include pattern รองรับชื่อนี้
ทุก test file ต้องขึ้นต้นด้วย:
// File: frontend/path/to/file.test.ts
// Change Log
// - YYYY-MM-DD: คำอธิบายการเปลี่ยนแปลง
แนวทางหลัก:
- ใช้
createTestQueryClient()จาก@/lib/test-utilsสำหรับ hook/component ที่ใช้ TanStack Query - Mock HTTP ผ่าน
apiClientที่ตั้งค่าไว้ในvitest.setup.ts - Mock data ฝั่ง Public API ต้องใช้
publicIdเป็น UUIDv7 ตาม ADR-019 - ห้ามใช้
console.logใน test - หลีกเลี่ยง
any; ถ้าจำเป็นต้อง mock shape บางส่วน ให้ใช้Partial<T>หรือ type เฉพาะของ test