Skip to content

Commit 3cfc149

Browse files
authored
test(rust-guard): cover all borrowed scope branches
1 parent 97bd137 commit 3cfc149

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

  • guards/github-guard/rust-guard/src

guards/github-guard/rust-guard/src/lib.rs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1113,6 +1113,22 @@ mod tests {
11131113
assert!(matches!(inferred, Cow::Borrowed("octocat/hello-world")));
11141114
}
11151115

1116+
#[test]
1117+
fn infer_scope_for_baseline_borrows_github_scope_for_repo_creation() {
1118+
let tool_args = json!({});
1119+
let inferred = infer_scope_for_baseline("create_repository", &tool_args, "");
1120+
1121+
assert!(matches!(inferred, Cow::Borrowed(scope_names::GITHUB)));
1122+
}
1123+
1124+
#[test]
1125+
fn infer_scope_for_baseline_borrows_empty_scope_for_other_tools() {
1126+
let tool_args = json!({});
1127+
let inferred = infer_scope_for_baseline("get_file_contents", &tool_args, "");
1128+
1129+
assert!(matches!(inferred, Cow::Borrowed("")));
1130+
}
1131+
11161132
#[test]
11171133
fn search_code_baseline_preserves_scoped_integrity() {
11181134
let ctx = PolicyContext {

0 commit comments

Comments
 (0)