Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
cruessler committed May 1, 2024
1 parent f3026a0 commit 32629e5
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions asyncgit/src/sync/remotes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,42 @@ mod tests {
));
}

#[test]
fn test_default_remote_for_fetch() {
let (remote_dir, _remote) = repo_init().unwrap();
let remote_path = remote_dir.path().to_str().unwrap();
let (repo_dir, repo) = repo_clone(remote_path).unwrap();
let repo_path: &RepoPath = &repo_dir
.into_path()
.as_os_str()
.to_str()
.unwrap()
.into();

debug_cmd_print(
repo_path,
"git remote rename origin alternate",
);

debug_cmd_print(
repo_path,
&format!("git remote add someremote {remote_path}")[..],
);

let mut config = repo.config().unwrap();

config
.set_str("branch.master.remote", "branchremote")
.unwrap();

let default_fetch_remote =
get_default_remote_for_fetch_in_repo(&repo);

assert!(
matches!(default_fetch_remote, Ok(remote_name) if remote_name == "branchremote")
);
}

#[test]
fn test_default_remote_for_push() {
let (remote_dir, _remote) = repo_init().unwrap();
Expand Down

0 comments on commit 32629e5

Please sign in to comment.