#[test]
fn test_token_estimation_heuristic() {
let test_string = "abcdefgh"; let estimated_tokens = test_string.len() / 4;
assert_eq!(estimated_tokens, 2, "Token estimation should use chars / 4");
}
#[test]
fn test_json_response_has_token_fields() {
use llmgrep::output::json_response;
use serde_json::json;
let response = json_response(json!({"test": "data"}));
let json_str = serde_json::to_string(&response).expect("Failed to serialize");
let parsed: serde_json::Value = serde_json::from_str(&json_str).expect("Failed to parse JSON");
assert!(
parsed.get("data").is_some(),
"JSON should include data field"
);
assert!(
parsed.get("partial").is_some(),
"JSON should include partial field"
);
}