> ## Documentation Index
> Fetch the complete documentation index at: https://docs.taho.com.vn/llms.txt
> Use this file to discover all available pages before exploring further.

# Kiểm thử

> Lệnh kiểm thử tự động và chỉ mục testcase cho PM, BA và QA.

`yarn test` tạo Prisma Client rồi chạy `tsx --test --test-concurrency=1`. `yarn test:coverage` thêm Node experimental coverage với ngưỡng line coverage 80.

`yarn test:e2e` build application rồi chạy `scripts/e2e-smoke.ts`. `yarn verify` chạy unit/integration tests và E2E command theo `package.json` hiện tại.

PM, BA và QA dùng [Chỉ mục testcase](https://docs.taho.com.vn/reference/manual-testcases.md) để tìm nhóm nghiệm thu và trang nghiệp vụ theo mã case. Trạng thái trong workbook là kết quả được ghi tại thời điểm kiểm thử, không thay thế việc đối chiếu source hoặc kiểm thử lại phiên bản hiện tại.

## Kiểm thử một use case

**1. Chọn use case**

Mở [Use case và workflow](https://docs.taho.com.vn/product-specs/workflow-specifications.md). Dùng bảng traceability để tìm rule, state, route, persistence và test liên quan.

**2. Đọc các nhánh**

Kiểm tra success path, rejection path và stopping point trên flowchart. Không thêm nhánh mà source không thực thi.

**3. Đối chiếu Acceptance Criteria**

Mỗi `Given` phải là trạng thái đầu vào được code kiểm tra. Mỗi `When` phải là action thật. Mỗi `Then` phải là kết quả quan sát được hoặc persistence/side effect đã trace.

**4. Chạy test hiện có**

Chạy `yarn test`. Dùng test file trong bảng truy vết để hỗ trợ xác minh; test không thay thế việc đọc handler và service.

## Kiểm thử theo workflow

| Workflow | Kiểm thử hiện có |
| - | - |
| Tính công nợ, duyệt bảng kê, phiếu thu và tiền thừa | `test/financial-workflows.test.ts` |
| Membership cư dân và resident import reconciliation | `test/resident-membership-workflows.test.ts` |
| Preview, queue và dispatch reminder | `test/debt-reminder-integration.test.ts` |
| Resend webhook | `test/resend-webhook.test.ts` |
| Parse và upload spreadsheet | `test/import-spreadsheet.test.ts`, `test/import-upload-boundaries.test.ts` |

Test case mapping cho mọi route còn lại: `Not confirmed by current source code.`

## Direct route gaps

Không tìm thấy test import trực tiếp:

* `app/admin/rbac/route.ts`
* `app/admin/repair-attachment/[recordId]/route.ts`
* `app/landing/contact/route.ts`

Service-level tests có thể hỗ trợ các paths này. Direct route gap không chứng minh runtime behavior thiếu.

Xem inventory handler tại [Route catalog](https://docs.taho.com.vn/reference/route-catalog.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.