{%- set test_cfg = testing if testing else {} -%}
{%- set ut = test_cfg.get('unit_test', {}) -%}
{%- set pqa = test_cfg.get('product_qa', {}) -%}
# V. Testing System

{% if ut.get('enabled', True) -%}
{%- set coverage = ut.get('coverage_target', 0.8) -%}
{%- set patterns = ut.get('patterns', ['**/*.test.ts']) -%}
{%- set run_on = ut.get('run_on', ['pre-commit', 'ci']) -%}
## 5.1 Unit Test

> **Developer perspective: verify code logic correctness**

| Config | Value |
|--------|-------|
| Framework | {{ ut.get('framework', 'jest') }} |
| Coverage Target | {{ (coverage * 100) | int }}% |
| File Patterns | {{ patterns | join(', ') }} |
| Run Timing | {{ run_on | join(', ') }} |

**Unit Test Principles**:
- Each module should have a corresponding test file
- Critical functions must have test coverage
- Tests should be independent and repeatable
- Mock external dependencies

{% endif -%}
{% if pqa.get('enabled', True) -%}
## 5.2 Product QA Acceptance

> **User perspective: verify features meet expectations**

**Test Case File**: `{{ pqa.get('test_case_file', 'docs/QA_TEST_CASES.md') }}`

**Case ID Format**: `{{ pqa.get('case_id_pattern', 'TC-{module}-{seq}') }}`

**Test Case Elements**:
{% for field in pqa.get('required_fields', []) -%}
- {{ field }}
{% endfor %}
**Test Statuses**:
{% for status in pqa.get('statuses', []) -%}
{% if status is mapping -%}
- {{ status.get('symbol', '') }} {{ status.get('meaning', '') }}
{% else -%}
- {{ status }}
{% endif -%}
{% endfor -%}
{% endif %}
## 5.3 Unit Test vs Product QA

| Dimension | Unit Test | Product QA |
|-----------|-----------|------------|
| Perspective | Developer | User |
| Goal | Code correctness | Feature completeness |
| Granularity | Function/module level | Feature/flow level |
| Execution | Automated | Automated + manual |
| Timing | On commit | On feature completion |
| Tools | Test framework | Test case manual |

---
