()
| 233 | |
| 234 | #[test] |
| 235 | fn only_active_command_entries_count() { |
| 236 | let prefix = "atomic agent hooks claude-code"; |
| 237 | let active = |command: &str| json!({"hooks":{"Stop":[{"hooks":[{"type":"command","command":command}]}]}}); |
| 238 | for command in ["atomic agent hooks claude-code stop", "test -d .atomic || test -f .atomic-sandbox && atomic agent hooks claude-code stop || true"] { |
| 239 | assert_eq!(json_hooks_active("claude-code", &active(command), "hooks", prefix), Ok(true)); |
| 240 | } |
| 241 | for root in [ |
| 242 | json!({"notes":prefix,"hooks":{}}), |
| 243 | json!({"disableAllHooks":true,"hooks":active(prefix)["hooks"]}), |
| 244 | json!({"hooks":{"Stop":[{"disabled":true,"hooks":[{"type":"command","command":format!("{prefix} stop")}]}]}}), |
| 245 | ] { |
| 246 | assert_eq!( |
| 247 | json_hooks_active("claude-code", &root, "hooks", prefix), |
| 248 | Ok(false), |
| 249 | "{root}" |
| 250 | ); |
| 251 | } |
| 252 | for command in [ |
| 253 | format!("echo {prefix} stop"), |
| 254 | "atomic agent hooks claude-code-not stop".to_string(), |
| 255 | ] { |
| 256 | assert!(json_hooks_active("claude-code", &active(&command), "hooks", prefix).is_err()); |
| 257 | } |
| 258 | } |
| 259 | |
| 260 | #[test] |
| 261 | fn supported_formats_and_disabled_states() { |
nothing calls this directly
no outgoing calls
no test coverage detected