| 1342 | |
| 1343 | #[test] |
| 1344 | fn test_settings_roundtrip() { |
| 1345 | let dir = tempfile::tempdir().unwrap(); |
| 1346 | let hook = make_hook(); |
| 1347 | |
| 1348 | // Install hooks |
| 1349 | hook.install(dir.path()).unwrap(); |
| 1350 | |
| 1351 | // Read back and verify structure |
| 1352 | let settings_path = dir.path().join(".gemini").join("settings.json"); |
| 1353 | let content = std::fs::read_to_string(&settings_path).unwrap(); |
| 1354 | let parsed: serde_json::Value = serde_json::from_str(&content).unwrap(); |
| 1355 | |
| 1356 | // Check that hooks are under PascalCase keys |
| 1357 | let hooks = parsed.get("hooks").unwrap(); |
| 1358 | assert!(hooks.get("SessionStart").is_some()); |
| 1359 | assert!(hooks.get("SessionEnd").is_some()); |
| 1360 | assert!(hooks.get("BeforeAgent").is_some()); |
| 1361 | assert!(hooks.get("AfterAgent").is_some()); |
| 1362 | assert!(hooks.get("BeforeTool").is_some()); |
| 1363 | assert!(hooks.get("AfterTool").is_some()); |
| 1364 | } |
| 1365 | |
| 1366 | #[test] |
| 1367 | fn test_settings_preserves_unknown_fields() { |