Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
test: add snapshot test for multi-remove hook branch context (#2016)
Maximilian Roos2514a79b3a88
diff --git a/tests/integration_tests/user_hooks.rs b/tests/integration_tests/user_hooks.rsindex 262973100..dd7ba013f 100644--- a/tests/integration_tests/user_hooks.rs+++ b/tests/integration_tests/user_hooks.rs@@ -2761,3 +2761,21 @@ fn test_standalone_hook_name_filtered_lazy_template(repo: TestRepo) {"Lazy template should expand {{ vars.name }} from git config");}++/// Multi-remove hook announcements include the branch name for disambiguation+#[rstest]+fn test_multi_remove_hook_announcements_include_branch(repo: TestRepo) {+ // fixture already has feature-a, feature-b, feature-c worktrees+ repo.write_test_config(+ r#"[post-remove]+cleanup = "echo done"+"#,+ );++ snapshot_remove(+ "multi_remove_hook_branch_context",+ &repo,+ &["feature-a", "feature-b", "--force-delete"],+ Some(repo.root_path()),+ );+}diff --git a/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap b/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snapnew file mode 100644index 000000000..24cf29c2c--- /dev/null+++ b/tests/snapshots/integration__integration_tests__user_hooks__multi_remove_hook_branch_context.snap@@ -0,0 +1,52 @@+---+source: tests/integration_tests/user_hooks.rs+info:+ program: wt+ args:+ - remove+ - feature-a+ - feature-b+ - "--force-delete"+ env:+ APPDATA: "[TEST_CONFIG_HOME]"+ CLICOLOR_FORCE: "1"+ COLUMNS: "500"+ GIT_AUTHOR_DATE: "2025-01-01T00:00:00Z"+ GIT_COMMITTER_DATE: "2025-01-01T00:00:00Z"+ GIT_CONFIG_GLOBAL: "[TEST_GIT_CONFIG]"+ GIT_CONFIG_SYSTEM: /dev/null+ GIT_EDITOR: ""+ GIT_TERMINAL_PROMPT: "0"+ HOME: "[TEST_HOME]"+ LANG: C+ LC_ALL: C+ MOCK_CONFIG_DIR: "[MOCK_CONFIG_DIR]"+ NO_COLOR: ""+ OPENCODE_CONFIG_DIR: "[TEST_OPENCODE_CONFIG]"+ PATH: "[PATH]"+ PSModulePath: ""+ RUST_LOG: warn+ SHELL: ""+ TERM: alacritty+ USERPROFILE: "[TEST_HOME]"+ WORKTRUNK_APPROVALS_PATH: "[TEST_APPROVALS]"+ WORKTRUNK_CONFIG_PATH: "[TEST_CONFIG]"+ WORKTRUNK_SYSTEM_CONFIG_PATH: "[TEST_SYSTEM_CONFIG]"+ WORKTRUNK_TEST_CLAUDE_INSTALLED: "0"+ WORKTRUNK_TEST_DELAYED_STREAM_MS: "-1"+ WORKTRUNK_TEST_EPOCH: "1735776000"+ WORKTRUNK_TEST_NUSHELL_ENV: "0"+ WORKTRUNK_TEST_OPENCODE_INSTALLED: "0"+ WORKTRUNK_TEST_POWERSHELL_ENV: "0"+ WORKTRUNK_TEST_SKIP_URL_HEALTH_CHECK: "1"+ XDG_CONFIG_HOME: "[TEST_CONFIG_HOME]"+---+success: true+exit_code: 0+----- stdout -----++----- stderr -----+[36m◎[39m [36mRemoving [1mfeature-a[22m worktree & branch in background (--force-delete)[39m+[36m◎[39m [36mRunning post-remove for [1mfeature-a[22m: [1muser:cleanup[22m[39m+[36m◎[39m [36mRemoving [1mfeature-b[22m worktree & branch in background (--force-delete)[39m+[36m◎[39m [36mRunning post-remove for [1mfeature-b[22m: [1muser:cleanup[22m[39m