- PostLike domain entity (post_id, liked_by) with BaseEntity integration
- Post entity: add like_count field (default 0) and to_dict serialization
- PostRepository interface: add get_like, add_like, remove_like methods
- TogglePostLikeUseCase: toggle logic (like → unlike, unlike → like)
- PostResponseDTO/PostResponseSchema: add like_count field
- PostLikeORM model with FK to posts and cascade delete
- SQLAlchemyPostRepository: implement like query/add/remove with ORM mapping
- DI provider registration for TogglePostLikeUseCase
- API endpoint POST /api/v1/posts/{id}/like (auth required)
- Unit tests: PostLike entity, Post.like_count, TogglePostLikeUseCase (7 tests)
- API tests: POST /api/v1/posts/{id}/like (4 tests)
- Test model files: FEATURE_LIKES.md, TEST_MODEL.md updated
61 lines
3.0 KiB
Markdown
61 lines
3.0 KiB
Markdown
# Test Model: Blog
|
|
|
|
Global test coverage map for the blog application. Use this file to assess
|
|
which features are covered, where gaps exist, and what to prioritize when
|
|
adding new tests.
|
|
|
|
## Coverage Matrix
|
|
|
|
| Feature | Unit | Integration | API | E2E | Priority | Status |
|
|
|---------|:----:|:-----------:|:---:|:---:|:--------:|:------:|
|
|
| Post Lifecycle (CRUD, Publish) | 85% | — | 90% | 70% | P0 | ✅ Active |
|
|
| RBAC & Access Control | 100% | — | 90% | 60% | P0 | ✅ Active |
|
|
| Domain Value Objects | 100% | — | — | — | P0 | ✅ Stable |
|
|
| Domain Entities | 95% | — | — | — | P0 | ✅ Stable |
|
|
| Domain Exceptions | 100% | — | — | — | P1 | ✅ Stable |
|
|
| List & Search Posts | 70% | — | — | — | P1 | ⚠️ Partial |
|
|
| Keycloak Auth Client | 80% | — | — | — | P0 | ✅ Active |
|
|
| App Bootstrap & Config | 75% | — | — | — | P1 | ✅ Stable |
|
|
| Transaction Manager | 60% | — | — | — | P2 | ⚠️ Partial |
|
|
| Web UI Error Handling | — | — | — | 50% | P1 | ⚠️ Partial |
|
|
| Pagination | 40% | — | — | 60% | P1 | ⚠️ Partial |
|
|
| Post Edit via Web | — | — | — | 40% | P1 | ⚠️ Partial |
|
|
| Post Delete via Web | — | — | — | 40% | P1 | ⚠️ Partial |
|
|
| i18n Localization | 100% | — | — | — | P1 | ✅ Active |
|
|
| Post Likes | 100% | — | 100% | — | P1 | ✅ Active |
|
|
|
|
Legend: ✅ Covered / ⚠️ Partial / ❌ Missing / — Not Applicable
|
|
|
|
## Feature Files
|
|
|
|
| Feature | Model File |
|
|
|---------|------------|
|
|
| Post Lifecycle | [FEATURE_POST_LIFECYCLE.md](FEATURE_POST_LIFECYCLE.md) |
|
|
| RBAC & Access Control | [FEATURE_RBAC.md](FEATURE_RBAC.md) |
|
|
| Domain Foundation | [FEATURE_DOMAIN_FOUNDATION.md](FEATURE_DOMAIN_FOUNDATION.md) |
|
|
| Infrastructure & Bootstrap | [FEATURE_INFRASTRUCTURE.md](FEATURE_INFRASTRUCTURE.md) |
|
|
| i18n Localization | [FEATURE_INFRASTRUCTURE.md](FEATURE_INFRASTRUCTURE.md) |
|
|
| Post Likes | [FEATURE_LIKES.md](FEATURE_LIKES.md) |
|
|
|
|
## Test Naming Convention
|
|
|
|
- **TC-UNIT-NNN**: Unit test case
|
|
- **TC-E2E-NNN**: End-to-end test case
|
|
- **TC-INT-NNN**: Integration test case
|
|
- **TC-API-NNN**: API test case
|
|
|
|
## How to Update This Model
|
|
|
|
1. When adding a new test, assign the next available TC-ID in the relevant feature file.
|
|
2. Update the Coverage Matrix above if the new test closes a gap or changes coverage percentage.
|
|
3. Update the `Last Verified` field in the feature file after running the test successfully.
|
|
4. When a test is deleted or renamed, update the corresponding TC entry and mark it as **Deprecated**.
|
|
|
|
## Risk Areas
|
|
|
|
1. **No Integration Tests**: SQLAlchemy repository has no integration tests against a real database.
|
|
2. **Restored API Tests**: API endpoint tests restored in `tests/api/` covering all CRUD, publish/unpublish, and RBAC policies.
|
|
3. **Web UI Error Handling**: Only covered indirectly via E2E; no dedicated error-scenario E2E tests.
|
|
4. **Pagination Edge Cases**: Page boundaries, empty pages, and large offsets are not explicitly tested.
|
|
5. **Edit/Delete Web Flows**: No E2E coverage for editing or deleting posts through the web UI.
|