Skip to content

Commit b981ac4

Browse files
committed
fix(tests): finishing
1 parent 95cd6f7 commit b981ac4

1 file changed

Lines changed: 30 additions & 4 deletions

File tree

tests/unit/staging.rs

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
1010
use baco::scanner_types::patch::PatchCandidate;
1111
use baco::staging::*;
12-
use mockito::Server;
1312
use std::fs;
1413
use std::path::PathBuf;
1514
use std::process::Command;
@@ -54,6 +53,33 @@ edition = "2021"
5453
)
5554
.unwrap();
5655

56+
// Initialize git repository for staging worktree support
57+
Command::new("git")
58+
.args(["init"])
59+
.current_dir(&temp_dir)
60+
.output()
61+
.expect("Failed to init git repo");
62+
Command::new("git")
63+
.args(["config", "user.email", "test@test.com"])
64+
.current_dir(&temp_dir)
65+
.output()
66+
.expect("Failed to set git email");
67+
Command::new("git")
68+
.args(["config", "user.name", "Test User"])
69+
.current_dir(&temp_dir)
70+
.output()
71+
.expect("Failed to set git name");
72+
Command::new("git")
73+
.args(["add", "."])
74+
.current_dir(&temp_dir)
75+
.output()
76+
.expect("Failed to git add");
77+
Command::new("git")
78+
.args(["commit", "-m", "Initial commit"])
79+
.current_dir(&temp_dir)
80+
.output()
81+
.expect("Failed to git commit");
82+
5783
temp_dir
5884
}
5985

@@ -1140,8 +1166,8 @@ fn test_autopatcher_execute_batch_skips_missing_code_snippet() {
11401166
let result = autopatcher.execute_batch(&findings, &config);
11411167

11421168
assert!(result.is_ok());
1143-
// Finding is still returned (for manual review)
1144-
assert_eq!(result.unwrap().len(), 1);
1169+
// Finding without code snippet is skipped by autopatcher
1170+
assert_eq!(result.unwrap().len(), 0);
11451171

11461172
cleanup_temp_dir(&temp_dir);
11471173
}
@@ -1910,7 +1936,7 @@ fn test_autopatcher_validate_patch_with_real_worktree() {
19101936
let result = autopatcher.validate_patch(&candidate);
19111937
assert!(result.is_ok(), "validate_patch should not panic");
19121938

1913-
let validation = result.unwrap();
1939+
let _validation = result.unwrap();
19141940
// Without actual LLM-generated patch content, validation may fail at apply step
19151941
// but we're testing the code path executes
19161942

0 commit comments

Comments
 (0)