Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
test(approvals): fix project_id mismatch in clear-approvals tests (#2293)
Maximilian Roos7b2bc2582d86
diff --git a/tests/integration_tests/approvals.rs b/tests/integration_tests/approvals.rsindex 97ec016c1..07cfcbbc4 100644--- a/tests/integration_tests/approvals.rs+++ b/tests/integration_tests/approvals.rs@@ -101,18 +101,18 @@ fn test_clear_approvals_no_approvals(repo: TestRepo) {#[rstest]fn test_clear_approvals_with_approvals(repo: TestRepo) {- // Remove origin so project_id uses directory name (matches test expectation)+ // Remove origin so project_identifier uses the canonical worktree path —+ // matches what `Repository::project_identifier` computes at runtime.repo.run_git(&["remote", "remove", "origin"]);- let project_id = format!("{}/origin", repo.root_path().display());repo.commit("Initial commit");repo.write_project_config(r#"post-create = "echo 'test'""#);repo.commit("Add config");- // Manually approve the command by writing to test config+ // Manually approve the command using the same project id wt will compute.let mut approvals = Approvals::default();approvals.approve_command(- project_id,+ repo.project_id(),"echo 'test'".to_string(),Some(repo.test_approvals_path()),)@@ -156,18 +156,18 @@ fn test_clear_approvals_global_with_approvals(repo: TestRepo) {#[rstest]fn test_clear_approvals_after_clear(repo: TestRepo) {- // Remove origin so project_id uses directory name (matches test expectation)+ // Remove origin so project_identifier uses the canonical worktree path —+ // matches what `Repository::project_identifier` computes at runtime.repo.run_git(&["remote", "remove", "origin"]);- let project_id = format!("{}/origin", repo.root_path().display());repo.commit("Initial commit");repo.write_project_config(r#"post-create = "echo 'test'""#);repo.commit("Add config");- // Manually approve the command+ // Manually approve the command using the same project id wt will compute.let mut approvals = Approvals::default();approvals.approve_command(- project_id.clone(),+ repo.project_id(),"echo 'test'".to_string(),Some(repo.test_approvals_path()),)@@ -223,7 +223,8 @@ approved-commands = ["cargo build", "cargo test", "npm install"]#[rstest]fn test_clear_approvals_multiple_approvals(repo: TestRepo) {- // Remove origin so project_id uses directory name (matches test expectation)+ // Remove origin so project_identifier uses the canonical worktree path —+ // matches what `Repository::project_identifier` computes at runtime.repo.run_git(&["remote", "remove", "origin"]);repo.write_project_config(r#"@@ -235,8 +236,8 @@ lint = "echo 'third'");repo.commit("Add config with multiple commands");- // Manually approve all commands- let project_id = format!("{}/origin", repo.root_path().display());+ // Manually approve all commands using the same project id wt will compute.+ let project_id = repo.project_id();let mut approvals = Approvals::default();approvals.approve_command(diff --git a/tests/snapshots/integration__integration_tests__approvals__clear_approvals_multiple_approvals.snap b/tests/snapshots/integration__integration_tests__approvals__clear_approvals_multiple_approvals.snapindex f0033a7f7..eccf55fac 100644--- a/tests/snapshots/integration__integration_tests__approvals__clear_approvals_multiple_approvals.snap+++ b/tests/snapshots/integration__integration_tests__approvals__clear_approvals_multiple_approvals.snap@@ -45,4 +45,4 @@ exit_code: 0----- stdout ---------- stderr ------[2m○[22m No approvals to clear for this project+[32m✓[39m [32mCleared 3 approvals for this project[39mdiff --git a/tests/snapshots/integration__integration_tests__approvals__clear_approvals_with_approvals.snap b/tests/snapshots/integration__integration_tests__approvals__clear_approvals_with_approvals.snapindex f0033a7f7..27e7c0e60 100644--- a/tests/snapshots/integration__integration_tests__approvals__clear_approvals_with_approvals.snap+++ b/tests/snapshots/integration__integration_tests__approvals__clear_approvals_with_approvals.snap@@ -45,4 +45,4 @@ exit_code: 0----- stdout ---------- stderr ------[2m○[22m No approvals to clear for this project+[32m✓[39m [32mCleared 1 approval for this project[39m