diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-20 15:17:54 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-20 15:18:03 +0300 |
| commit | 28b628d79d755afbb3ac45f9184a03c204c26784 (patch) | |
| tree | 93ee9f4c9939430c5e82b22da7c080f99f882fe0 /src/integration/tests.rs | |
| parent | 9450b168c727e9e4cbee95e6edf4f11cfe6f2154 (diff) | |
fix: report kimi questions as blocked
Diffstat (limited to 'src/integration/tests.rs')
| -rw-r--r-- | src/integration/tests.rs | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/integration/tests.rs b/src/integration/tests.rs index 41714ffa..786e67fb 100644 --- a/src/integration/tests.rs +++ b/src/integration/tests.rs @@ -116,16 +116,23 @@ fn kimi_config_hooks(config: &str) -> Vec<toml::Value> { .unwrap_or_default() } -fn assert_kimi_hook(config: &str, hook_path: &Path, event: &str, action: &str) { +fn assert_kimi_hook( + config: &str, + hook_path: &Path, + event: &str, + matcher: Option<&str>, + action: &str, +) { let command = kimi_hook_command(hook_path, action); let hooks = kimi_config_hooks(config); assert!( hooks.iter().any(|hook| { hook.get("event").and_then(toml::Value::as_str) == Some(event) + && hook.get("matcher").and_then(toml::Value::as_str) == matcher && hook.get("command").and_then(toml::Value::as_str) == Some(command.as_str()) && hook.get("timeout").and_then(toml::Value::as_integer) == Some(10) }), - "missing kimi hook for {event} -> {action}" + "missing kimi hook for {event} ({matcher:?}) -> {action}" ); } @@ -1434,8 +1441,8 @@ fn install_kimi_writes_hook_and_updates_config() { assert!(config.contains("command = \"echo keep\"")); assert!(config.contains(KIMI_CONFIG_BLOCK_BEGIN)); assert!(config.contains(KIMI_CONFIG_BLOCK_END)); - for (event, action) in KIMI_HOOK_EVENTS { - assert_kimi_hook(&config, &installed.hook_path, event, action); + for (event, matcher, action) in KIMI_HOOK_EVENTS { + assert_kimi_hook(&config, &installed.hook_path, event, matcher, action); } std::env::remove_var("HOME"); @@ -1443,6 +1450,26 @@ fn install_kimi_writes_hook_and_updates_config() { } #[test] +fn kimi_question_hooks_report_blocked_until_the_question_finishes() { + assert!(KIMI_HOOK_EVENTS.contains(&( + "PreToolUse", + Some(KIMI_ASK_USER_QUESTION_MATCHER), + "blocked", + ))); + assert!(KIMI_HOOK_EVENTS.contains(&( + "PostToolUse", + Some(KIMI_ASK_USER_QUESTION_MATCHER), + "working", + ))); + assert!(KIMI_HOOK_EVENTS.contains(&( + "PostToolUseFailure", + Some(KIMI_ASK_USER_QUESTION_MATCHER), + "working", + ))); + assert!(KIMI_HOOK_EVENTS.contains(&("PreToolUse", Some(KIMI_OTHER_TOOL_MATCHER), "working",))); +} + +#[test] fn install_kimi_uses_kimi_code_home_env() { let _lock = integration_env_lock(); let base = unique_base(); |
