refactor: overhaul test suite and application architecture #15

Merged
eleith merged 5 commits from gemini/feature/test-refactoring into main 2025-07-24 16:38:44 +00:00
Owner

This PR overhauls the testing infrastructure and application architecture for improved
testability and developer workflow.

  • Test Scripts:

    • Adds a check-coverage.sh script with two modes:
      • --mode=packages: A package-level summary for CI.
      • --mode=functions: A detailed function-level report for local development.
    • Updates Makefile with test-coverage and test-coverage-full targets.
  • Application Architecture:

    • Moves main entry point to cmd/miniflux-digest.
    • Introduces an internal/app package to manage dependency injection.
  • Testing Improvements:

    • Increases total test coverage from 71.4% to 72.4%.
    • Adds tests for MarkCategoryAsRead error handling.
    • Centralizes all service and data mocks into the internal/testutil package.
This PR overhauls the testing infrastructure and application architecture for improved testability and developer workflow. * Test Scripts: * Adds a check-coverage.sh script with two modes: * --mode=packages: A package-level summary for CI. * --mode=functions: A detailed function-level report for local development. * Updates Makefile with test-coverage and test-coverage-full targets. * Application Architecture: * Moves main entry point to cmd/miniflux-digest. * Introduces an internal/app package to manage dependency injection. * Testing Improvements: * Increases total test coverage from 71.4% to 72.4%. * Adds tests for MarkCategoryAsRead error handling. * Centralizes all service and data mocks into the internal/testutil package.
eleith added 5 commits 2025-07-24 16:34:14 +00:00
- Introduces `check-coverage.sh` to handle test coverage reporting
- Adds `--mode` flag to switch between package and function-level reports
- `make test-coverage` provides a package-level summary for CI
- `make test-coverage-full` provides a detailed function-level report for local development
- Moves the main application entry point to `cmd/miniflux-digest`
- Introduces an `internal/app` package to house the core application struct and service interfaces
- Implements dependency injection to make the application more modular and testable
- Updates the `Dockerfile` to build the new application structure
- Adds a new test to `processor_test.go` to cover the error handling path for `MarkCategoryAsRead`
- Adds a new test file, `miniflux_client_wrapper_test.go`, to provide dedicated coverage for the `MinifluxClientWrapper`
- Increases total test coverage from 71.4% to 72.4%
- Moves all service mocks (`MinifluxClient`, `ArchiveService`, `EmailService`) to the `internal/testutil` package
- Expands the mock data factories in `testutil` to include `NewMockCategory`, `NewMockEntry`, and `NewMockFeedIcon`
- Refactors all tests to use the new centralized mocks and data factories
- This reduces code duplication and improves the consistency and maintainability of the test suite
- Deletes the old top-level config files
- Updates the remaining service files (`archive`, `category`, `email`, `processor`) to align with the new dependency injection structure
- Modifies the `preview-miniflux-email` script to use the new application factory
eleith merged commit 8d3deea6b6 into main 2025-07-24 16:38:44 +00:00
eleith deleted branch gemini/feature/test-refactoring 2025-07-24 16:38:44 +00:00
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: eleith/miniflux-digest#15