🧪 Complete test suite and modular CLI refactor (v0.5.0) #18

Merged
umpire274 merged 1 commit from v0.5.0 into main 2025-11-11 16:53:45 +01:00
umpire274 commented 2025-11-11 16:51:58 +01:00 (Migrated from github.com)

Summary

This PR marks a major structural milestone for Librius, completing the first phase of the roadmap (v0.5.x):
the implementation of a comprehensive test suite and a full CLI modular refactor.

The CLI is now cleanly separated into logical components (args.rs, dispatch.rs, mod.rs) and all test code has been consolidated under /tests, providing a solid foundation for future releases, including the upcoming librius_core crate and GUI frontend.


🧪 Added

  • Complete automated test suite for both database and CLI layers.
  • Implemented setup_temp_db() utility for creating temporary SQLite databases cross-platform:
    • Windows → %TEMP%\librius_test_*.db
    • macOS / Linux → /tmp/librius_test_*.db
  • Added unit tests for database insert/search operations using the full production schema.
  • Added integration tests for:
    • CLI commands (--help, search, etc.) via assert_cmd and predicates.
    • Database schema validation and ISBN normalization.
  • All test modules now use the real production schema for accurate, reproducible results.

🔧 Changed

  • Refactored the CLI architecture into a modular structure:
    • cli/args.rs → defines commands, subcommands, and global options.
    • cli/dispatch.rs → handles parsing and subcommand execution.
    • cli/mod.rs → acts as unified entry point, exporting build_cli(), run_cli(), and parse_cli().
  • Removed the legacy monolithic cli.rs and migrated remaining logic into mod.rs.
  • Simplified command routing and improved maintainability.
  • Enhanced localization consistency and display order of subcommands.

🧱 Internal

  • Removed obsolete #[cfg(test)] modules from isbn.rs and lib.rs.
  • Consolidated all test files under /tests/ for a cleaner and unified structure.
  • Resolved all Clippy and build warnings.
  • Verified cross-platform behavior (Windows, macOS, Linux).
  • Established the foundation for upcoming multi-platform CI automation in v0.5.1.

Testing

  • Executed full test suite on Windows, macOS, and Linux.
  • Verified database and CLI integration via cargo test -- --nocapture.
  • Confirmed zero Clippy warnings and stable builds on all platforms.

📦 Version

Release: v0.5.0
Date: 2025-11-11

## ✨ Summary This PR marks a major structural milestone for **Librius**, completing the first phase of the roadmap (v0.5.x): the implementation of a **comprehensive test suite** and a full **CLI modular refactor**. The CLI is now cleanly separated into logical components (`args.rs`, `dispatch.rs`, `mod.rs`) and all test code has been consolidated under `/tests`, providing a solid foundation for future releases, including the upcoming `librius_core` crate and GUI frontend. --- ## 🧪 Added - **Complete automated test suite** for both database and CLI layers. - Implemented `setup_temp_db()` utility for creating **temporary SQLite databases** cross-platform: - Windows → `%TEMP%\librius_test_*.db` - macOS / Linux → `/tmp/librius_test_*.db` - Added **unit tests** for database insert/search operations using the full production schema. - Added **integration tests** for: - CLI commands (`--help`, `search`, etc.) via `assert_cmd` and `predicates`. - Database schema validation and ISBN normalization. - All test modules now use the **real production schema** for accurate, reproducible results. --- ## 🔧 Changed - Refactored the **CLI architecture** into a modular structure: - `cli/args.rs` → defines commands, subcommands, and global options. - `cli/dispatch.rs` → handles parsing and subcommand execution. - `cli/mod.rs` → acts as unified entry point, exporting `build_cli()`, `run_cli()`, and `parse_cli()`. - Removed the legacy monolithic `cli.rs` and migrated remaining logic into `mod.rs`. - Simplified command routing and improved maintainability. - Enhanced localization consistency and display order of subcommands. --- ## 🧱 Internal - Removed obsolete `#[cfg(test)]` modules from `isbn.rs` and `lib.rs`. - Consolidated all test files under `/tests/` for a cleaner and unified structure. - Resolved all Clippy and build warnings. - Verified cross-platform behavior (Windows, macOS, Linux). - Established the foundation for upcoming **multi-platform CI automation** in `v0.5.1`. --- ## ✅ Testing - Executed full test suite on Windows, macOS, and Linux. - Verified database and CLI integration via `cargo test -- --nocapture`. - Confirmed zero Clippy warnings and stable builds on all platforms. --- ## 📦 Version Release: **v0.5.0** Date: **2025-11-11**
Sign in to join this conversation.
No description provided.