Fixed test

This commit is contained in:
Mick Grove 2025-10-05 18:07:45 -07:00
commit 39dc0b0e35
2 changed files with 23 additions and 26 deletions

View file

@ -109,7 +109,7 @@ fn normalize_repo_identifier(parts: &[String]) -> Option<String> {
}
fn parse_repo_identifier_from_path(path: &str) -> Option<String> {
let mut segments: Vec<String> = path
let segments: Vec<String> = path
.trim_matches('/')
.split('/')
.filter(|s| !s.is_empty())

View file

@ -126,31 +126,6 @@ fn build_git_urls(
(repository_url, commit_url, file_url)
}
#[cfg(test)]
mod tests {
use super::build_git_urls;
#[test]
fn azure_commit_links_use_query_paths() {
let (repo_url, commit_url, file_url) = build_git_urls(
"https://dev.azure.com/org/project/_git/repo",
"0123456789abcdef",
"dir/file.txt",
7,
);
assert_eq!(repo_url, "https://dev.azure.com/org/project/_git/repo");
assert_eq!(
commit_url,
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef"
);
assert_eq!(
file_url,
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef?path=/dir/file.txt&line=7"
);
}
}
pub fn run(
global_args: &GlobalArgs,
ds: Arc<Mutex<findings_store::FindingsStore>>,
@ -902,6 +877,28 @@ mod tests {
.unwrap();
assert_eq!(git_file_path, "path/in/history.txt");
}
use super::build_git_urls;
#[test]
fn azure_commit_links_use_query_paths() {
let (repo_url, commit_url, file_url) = build_git_urls(
"https://dev.azure.com/org/project/_git/repo",
"0123456789abcdef",
"dir/file.txt",
7,
);
assert_eq!(repo_url, "https://dev.azure.com/org/project/_git/repo");
assert_eq!(
commit_url,
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef"
);
assert_eq!(
file_url,
"https://dev.azure.com/org/project/_git/repo/commit/0123456789abcdef?path=/dir/file.txt&line=7"
);
}
}
impl From<finding_data::FindingDataEntry> for ReportMatch {