Worktrunk is a CLI for Git worktree management, designed for parallel AI agent workflows
test: make three config-state and bare-repo tests check what they claim (#4409)
Worktrunk Bot65f52af7a8d8
diff --git a/tests/integration_tests/bare_repository.rs b/tests/integration_tests/bare_repository.rsindex 8106aeb4f..8f1247c94 100644--- a/tests/integration_tests/bare_repository.rs+++ b/tests/integration_tests/bare_repository.rs@@ -1044,15 +1044,21 @@ fn test_bare_repo_no_project_config_when_primary_off_branch_and_none_present() {// No config exists, so no worktree should be reported as carrying one and// no project hook can run. `wt config show` from the bare root confirms the// fallback found nothing rather than resolving a phantom config.- let mut show = wt_command();- test.configure_wt_cmd(&mut show);- show.args(["config", "show"])+ let mut show = test.wt_command();+ show.args(["config", "show", "--format=json"]).current_dir(test.bare_repo_path());let show_out = show.output().unwrap();- let stdout = String::from_utf8_lossy(&show_out.stdout);assert!(- !stdout.contains("[pre-start]") && !stdout.contains("[post-start]"),- "no project hooks should be resolved when no config exists:\n{stdout}"+ show_out.status.success(),+ "stderr: {}",+ String::from_utf8_lossy(&show_out.stderr)+ );+ let json: serde_json::Value =+ serde_json::from_str(&String::from_utf8_lossy(&show_out.stdout)).unwrap();+ assert!(+ json["project"]["config"].is_null(),+ "no project config should be resolved when none exists, got: {}",+ json["project"]["config"]);}diff --git a/tests/integration_tests/config_state.rs b/tests/integration_tests/config_state.rsindex 733b4df45..ad07cf2f7 100644--- a/tests/integration_tests/config_state.rs+++ b/tests/integration_tests/config_state.rs@@ -136,7 +136,9 @@ fn test_state_get_default_branch(repo: TestRepo) {#[rstest]fn test_state_get_default_branch_no_remote(repo: TestRepo) {- // Without remote, should infer from local branches+ // Remove origin (fixture has it) so the branch is inferred from local branches+ repo.run_git(&["remote", "remove", "origin"]);+let output = wt_state_cmd(&repo, "default-branch", "get", &[]).output().unwrap();@@ -1392,9 +1394,7 @@ fn test_state_clear_logs_single_file(repo: TestRepo) {// ============================================================================fn wt_state_clear_all_cmd(repo: &TestRepo) -> std::process::Command {- let mut cmd = wt_command();- cmd.current_dir(repo.root_path());- cmd.env("CLICOLOR_FORCE", "1");+ let mut cmd = repo.wt_command();// `clear` prompts before removing markers/vars; `--yes` skips it so these// tests exercise the clearing itself. The prompt path has its own tests.cmd.args(["config", "state", "clear", "--yes"]);@@ -1546,9 +1546,7 @@ fn test_state_clear_all_nothing_to_clear(repo: TestRepo) {/// Run `wt config state clear` (no `--yes`) with the given stdin, so the/// confirmation prompt reads `input`.fn clear_all_with_stdin(repo: &TestRepo, input: &str) -> std::process::Output {- let mut cmd = wt_command();- cmd.current_dir(repo.root_path());- cmd.env("CLICOLOR_FORCE", "1");+ let mut cmd = repo.wt_command();cmd.args(["config", "state", "clear"]);cmd.stdin(Stdio::piped());cmd.stdout(Stdio::piped());@@ -1572,9 +1570,7 @@ fn test_state_clear_all_prompt_declines(repo: TestRepo) {.run().unwrap();- let mut cmd = wt_command();- cmd.current_dir(repo.root_path());- cmd.env("CLICOLOR_FORCE", "1");+ let mut cmd = repo.wt_command();cmd.args(["config", "state", "clear"]);cmd.stdin(Stdio::null());let output = cmd.output().unwrap();