test: add unit tests for branches.rs pure functions#586
Closed
Conversation
Cover 13 pure/utility functions with 65 tests: - infer_branch_name: sanitization, special chars, empty input - infer_workspace_name: prefix, truncation, dash collapsing - repo_name_from_github_repo: slug extraction, sanitization - validate_workspace_subpath: empty, dot segments, slash trimming - normalize_branch_ref: origin/ prefix stripping - resolve_workspace_repo_path: home: prefix resolution - workspace_home_dir: always /home/bloxer - is_worktree_path_exists_error: error message matching - is_blox_onboarding_precondition_error: error classification - map_blox_status_to_workspace_status: all status transitions - bootstrap_command_type_name: command type mapping - parse_git_progress_line: git progress parsing - fallback_worktree_path_for: path fallback with tempdir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a comprehensive
#[cfg(test)] mod teststobranches.rscovering all 13 pure/utility functions with 65 unit tests.Functions tested
infer_branch_nameinfer_workspace_namerepo_name_from_github_repovalidate_workspace_subpathnormalize_branch_reforigin/prefix, no prefix, nested pathsresolve_workspace_repo_pathhome:prefix resolution, nested paths, passthroughworkspace_home_dir/home/bloxeris_worktree_path_exists_erroris_blox_onboarding_precondition_errormap_blox_status_to_workspace_statusbootstrap_command_type_nameparse_git_progress_linefallback_worktree_path_forChanges
apps/staged/src-tauri/src/branches.rs— added#[cfg(test)] mod tests(+495 lines)apps/staged/src-tauri/Cargo.toml— addedtempfile = "3"dev-dependencyCargo.lock— updated for tempfile