()
| 140 | |
| 141 | #[test] |
| 142 | fn test_query_result_to_json() { |
| 143 | let temp = create_test_repo(); |
| 144 | let mut repo = GitRepo::open(temp.path()).expect("Failed to open repo"); |
| 145 | let mut engine = SqlEngine::new().expect("Failed to create engine"); |
| 146 | |
| 147 | engine |
| 148 | .load_tables_for_query("SELECT * FROM commits", &mut repo) |
| 149 | .expect("Failed to load tables"); |
| 150 | |
| 151 | let result = engine |
| 152 | .execute("SELECT short_id, summary FROM commits LIMIT 1") |
| 153 | .expect("Failed to execute query"); |
| 154 | |
| 155 | let json = result.to_json_array(); |
| 156 | assert_eq!(json.len(), 1, "Should have 1 JSON object"); |
| 157 | assert!(json[0].is_object(), "Should be a JSON object"); |
| 158 | assert!(json[0].get("short_id").is_some(), "Should have short_id"); |
| 159 | assert!(json[0].get("summary").is_some(), "Should have summary"); |
| 160 | } |
| 161 | |
| 162 | #[test] |
| 163 | fn test_table_not_found() { |
nothing calls this directly
no test coverage detected