Skip to content

Add integration tests for parsers and stash service#57

Merged
ruru-m07 merged 7 commits into
devfrom
ruru-tests-initial
Feb 28, 2026
Merged

Add integration tests for parsers and stash service#57
ruru-m07 merged 7 commits into
devfrom
ruru-tests-initial

Conversation

@ruru-m07

Copy link
Copy Markdown
Owner
  • Implement integration tests for commit, branch, status, history, and stash parsers using real git repositories.
  • Create a new test suite for StashService, covering functionalities like stash push, pop, apply, drop, and listing stashes.
  • Ensure tests validate expected behaviors for various scenarios, including handling of untracked files and branch-aware stashing.

- Implement integration tests for commit, branch, status, history, and stash parsers using real git repositories.
- Create a new test suite for StashService, covering functionalities like stash push, pop, apply, drop, and listing stashes.
- Ensure tests validate expected behaviors for various scenarios, including handling of untracked files and branch-aware stashing.
…ache, commit, graph, stash, and runner modules
@ruru-m07 ruru-m07 marked this pull request as ready for review February 28, 2026 11:21
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@ruru-m07 ruru-m07 left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ruru-m07 ruru-m07 merged commit cf4c401 into dev Feb 28, 2026
6 checks passed
@ruru-m07 ruru-m07 deleted the ruru-tests-initial branch February 28, 2026 11:22
@greptile-apps

greptile-apps Bot commented Feb 28, 2026

Copy link
Copy Markdown

Greptile Summary

This PR significantly improves test coverage by adding comprehensive integration tests for parsers and services, along with code quality improvements.

Key Changes:

  • Added integration tests for all major parsers (commit, branch, status, history, stash) using real git repositories instead of mocked data
  • Created full test suites for service layers (StashService, BranchService, CommitService, ActionService)
  • Introduced TestRepo helper utility that simplifies test setup by creating temporary git repositories with common operations
  • Set up CI/CD workflow for cross-platform testing on Ubuntu, macOS, and Windows
  • Refactored codebase to use modern Rust syntax (let-chains, string interpolation)
  • Added unit tests for pure functions and edge cases in parsers
  • Fixed clippy lint by changing &String to &str in detect_provider

Test Quality:

  • Tests use serial_test to prevent race conditions from parallel execution
  • Integration tests validate against real git output, ensuring parsers handle actual git behavior
  • Good coverage of edge cases (empty repos, unicode characters, multiple files, conflicts)
  • Async tests properly use tokio runtime via run_async helper

Code Quality Improvements:

  • Modernized conditionals using let-chains (if let ... && let ...)
  • Consistent string interpolation instead of format! macro
  • Removed unnecessary return statements
  • Better error messages throughout

Confidence Score: 5/5

  • This PR is safe to merge with no issues found
  • The PR adds comprehensive test coverage without modifying critical business logic. All changes are well-structured, use proper test isolation, and follow Rust best practices. The CI/CD setup ensures tests run across platforms. Code refactoring uses modern, idiomatic Rust syntax that improves readability without changing behavior.
  • No files require special attention

Important Files Changed

Filename Overview
crates/git/tests/parser_integration.rs Added comprehensive integration tests for commit, branch, status, history, and stash parsers using real git repositories
crates/git/tests/stash_service.rs Added thorough integration tests for StashService covering push, pop, apply, drop, clear, and gitru-specific stash features
crates/git/tests/common/mod.rs Created TestRepo helper utility with git operations for test setup; includes async runtime helper
crates/git/tests/branch_service.rs Added integration tests for BranchService covering branch creation, switching, listing, and uncommitted changes handling
crates/git/tests/commit_service.rs Added integration tests for CommitService covering commit creation, retrieval, history, and co-author handling
crates/git/tests/actions_service.rs Added integration tests for ActionService covering git add, remove, discard, and status operations
crates/git/parsers/commit.rs Refactored to use let-chains syntax and added unit tests for helper functions like normalize_email and extract_co_authors
crates/git/parsers/stash.rs Refactored to use let-chains and string interpolation; added unit tests for pure functions and edge cases
crates/git/runner.rs Refactored to use let-chains and string interpolation; added unit tests for path validation and helper functions
.github/workflows/test.yml Added CI/CD workflow for cross-platform testing (Ubuntu, macOS, Windows) and linting (format check, clippy)

Last reviewed commit: b6fafc7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant