MCPcopy Create free account
hub / github.com/dtormoen/tsk-tsk / test_resolve_branch_commit

Function test_resolve_branch_commit

src/git_operations.rs:926–959  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 7

resolve_branch_commitFunction · 0.85
init_with_main_branchMethod · 0.80
create_fileMethod · 0.80
stage_allMethod · 0.80
commitMethod · 0.80
run_git_commandMethod · 0.80
pathMethod · 0.80

Tested by

no test coverage detected