Skip to content

Commit 2d18654

Browse files
unhappychoiceclaude
andcommitted
test(fetcher/gitlab/common): assert structural project path instead of hard-coded slug
`resolve_project_falls_back_to_the_cwd_git_remote` asserted the literal `unhappychoice/splashboard`, which fails on forks and mirrors whose `origin` remote carries a different owner. Assert the `group/project` shape (two-plus non-empty segments) so the test exercises the same code path without pinning a repository-specific slug. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 7f16c4c commit 2d18654

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

‎src/fetcher/gitlab/common.rs‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,8 +335,9 @@ mod tests {
335335
fn resolve_project_falls_back_to_the_cwd_git_remote() {
336336
// With no explicit `project`, resolution walks the cwd's git remote. The suite runs
337337
// inside splashboard's own repo, whose `origin` lives on github.com — passing that
338-
// host lets the generic prefix parser recover `unhappychoice/splashboard` from the
339-
// remote URL, exercising the `Some(path) => Ok(path)` arm.
338+
// host lets the generic prefix parser recover the `group/project` path from the
339+
// remote URL, exercising the `Some(path) => Ok(path)` arm. Assert the structural
340+
// shape rather than a literal slug so forks and mirrors don't fail the test.
340341
let _lock = crate::paths::TEST_ENV_LOCK
341342
.lock()
342343
.unwrap_or_else(|e| e.into_inner());
@@ -345,7 +346,12 @@ mod tests {
345346
let resolved = resolve_project(None, "github.com");
346347
std::env::set_current_dir(previous).unwrap();
347348
let path = resolved.expect("cwd repo remote should resolve a project");
348-
assert_eq!(path.as_str(), "unhappychoice/splashboard");
349+
let segments: Vec<&str> = path.as_str().split('/').collect();
350+
assert!(
351+
segments.len() >= 2 && segments.iter().all(|s| !s.is_empty()),
352+
"expected a `group/project` path, got {:?}",
353+
path.as_str()
354+
);
349355
}
350356

351357
#[test]

0 commit comments

Comments
 (0)