| 1308 | |
| 1309 | #[test] |
| 1310 | fn test_settings_roundtrip() { |
| 1311 | let dir = tempfile::tempdir().unwrap(); |
| 1312 | let hook = make_hook(); |
| 1313 | |
| 1314 | // Install hooks |
| 1315 | hook.install(dir.path()).unwrap(); |
| 1316 | |
| 1317 | // Read back and verify structure |
| 1318 | let settings_path = dir.path().join(".gemini").join("settings.json"); |
| 1319 | let content = std::fs::read_to_string(&settings_path).unwrap(); |
| 1320 | let parsed: serde_json::Value = serde_json::from_str(&content).unwrap(); |
| 1321 | |
| 1322 | // Check that hooks are under PascalCase keys |
| 1323 | let hooks = parsed.get("hooks").unwrap(); |
| 1324 | assert!(hooks.get("SessionStart").is_some()); |
| 1325 | assert!(hooks.get("SessionEnd").is_some()); |
| 1326 | assert!(hooks.get("BeforeAgent").is_some()); |
| 1327 | assert!(hooks.get("AfterAgent").is_some()); |
| 1328 | assert!(hooks.get("BeforeTool").is_some()); |
| 1329 | assert!(hooks.get("AfterTool").is_some()); |
| 1330 | } |
| 1331 | |
| 1332 | #[test] |
| 1333 | fn test_settings_preserves_unknown_fields() { |