added extra Core Git operation unit tests (issue 1) & fixed CI depend…#20
Conversation
Dancode-188
left a comment
There was a problem hiding this comment.
Hey @sat048, thanks for taking this on. Really solid work here.
Code Review
The test structure looks good - proper isolation with tempfile, comprehensive coverage of the five core operations, and you're testing edge cases (empty repos, invalid paths, message validation). All CI checks passing across platforms.
A few things I noticed:
Test quality: The helper functions (setup_test_repo, create_file, etc.) are well thought out. Makes the tests readable and maintainable. Coverage bump to ~13% is significant.
Out of scope changes:
- The PushDialog.tsx TypeScript fix is good -
ReturnType<typeof setInterval>is the correct type. Just curious if you ran into this while testing or noticed it separately? Not a blocker either way, but typically we'd split unrelated fixes into separate PRs to keep the git history clean. - The gitignore additions for coverage/ make sense given the context.
Formatting: Looks like you ran rustfmt/clippy (explains the 512 line delta). Good practice. We should probably add that to our CI if it's not already there.
Approval
This is ready to merge. The test foundation you've built here is exactly what we needed - good patterns for future contributors to follow.
If you're interested in continuing, there are ~27 more backend commands that need test coverage (branches, remotes, rebase, stash operations). But no pressure - this PR alone is a solid contribution.
Merging this now. Thanks for the quality work.
…encies
Description
Type of Change
Related Issues
Fixes #1
Relates to #1
Changes Made
src-tauri/src/lib.rs:get_commits: Tests limit/offset parameters, empty repository handlingstage_files: Tests single/multiple file staging, nonexistent pathsunstage_files: Tests single/multiple file unstagingcreate_commit: Tests valid commits, empty/whitespace-only messages, varied message formatsget_working_directory_status: Tests clean, modified, staged, mixed, deleted, and invalid-path scenariostempfileas a dev-dependency insrc-tauri/Cargo.tomlfor temporary repository creation in tests.github/workflows/ci.yml) to consider an extra dependency for these tests:pkg-config,libgtk-3-dev,libwebkit2gtk-4.1-dev,libappindicator3-dev,librsvg2-dev,patchelf,xdg-utilsto test jobsrc-tauri/src/lib.rsScreenshots (if applicable)
Testing
Test Environment
Test Cases
get_commits: Limit/offset pagination, empty repo handlingstage_files: Single file, multiple files, nonexistent pathsunstage_files: Single file, multiple filescreate_commit: Valid commits, empty messages, whitespace-only messages, multiline messagesget_working_directory_status: Clean state, modified files, staged files, mixed state, deleted filesget_commitswith no commits)stage_files,unstage_fileswith invalid paths)create_commit)get_commits)get_working_directory_status)PR Guidelines Checklist
.gitignore,LICENSE,package.json, orREADME.mdwithout prior discussion in an issuepackage-lock.json(this breaks dependency reproducibility)Code Quality Checklist
Additional Notes
tempfile::TempDirto create isolated temporary Git repositories, ensuring test isolation and no side effects.gitignore,LICENSE,package.jsonrequire discussion firstBy submitting this pull request, I confirm that my contribution is made under the terms of the MIT license.