()
| 924 | |
| 925 | #[tokio::test] |
| 926 | async fn test_resolve_branch_commit() { |
| 927 | let test_repo = TestGitRepository::new().unwrap(); |
| 928 | test_repo.init_with_main_branch().unwrap(); |
| 929 | test_repo.create_file("file.txt", "content").unwrap(); |
| 930 | test_repo.stage_all().unwrap(); |
| 931 | test_repo.commit("Add file").unwrap(); |
| 932 | |
| 933 | // Create a feature branch with an additional commit |
| 934 | test_repo |
| 935 | .run_git_command(&["checkout", "-b", "feature"]) |
| 936 | .unwrap(); |
| 937 | test_repo |
| 938 | .create_file("feature.txt", "feature content") |
| 939 | .unwrap(); |
| 940 | test_repo.stage_all().unwrap(); |
| 941 | let feature_commit = test_repo.commit("Add feature file").unwrap(); |
| 942 | |
| 943 | // Go back to main |
| 944 | test_repo.run_git_command(&["checkout", "main"]).unwrap(); |
| 945 | |
| 946 | // Valid branch should resolve |
| 947 | let result = resolve_branch_commit(test_repo.path(), "feature").await; |
| 948 | assert!(result.is_ok()); |
| 949 | assert_eq!(result.unwrap(), feature_commit); |
| 950 | |
| 951 | // Invalid branch should error |
| 952 | let result = resolve_branch_commit(test_repo.path(), "nonexistent").await; |
| 953 | assert!(result.is_err()); |
| 954 | let err = result.unwrap_err(); |
| 955 | assert!( |
| 956 | err.contains("not found"), |
| 957 | "Should mention branch not found: {err}" |
| 958 | ); |
| 959 | } |
| 960 | } |
nothing calls this directly
no test coverage detected