MCPcopy Create free account
hub / github.com/douglance/devsql / test_sql_reads_jhistory_rows

Function test_sql_reads_jhistory_rows

crates/ccql/src/sql/mod.rs:315–347  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

313
314 #[tokio::test]
315 async fn test_sql_reads_jhistory_rows() {
316 let claude_dir = tempdir().expect("claude temp dir");
317 let codex_dir = tempdir().expect("codex temp dir");
318
319 std::fs::write(
320 codex_dir.path().join("history.jsonl"),
321 r#"{"session_id":"s1","ts":1700000000,"text":"first prompt"}"#.to_string()
322 + "\n"
323 + r#"{"session_id":"s2","ts":1700000001,"text":"second prompt"}"#,
324 )
325 .expect("write jhistory");
326
327 let config = Config::new_with_codex_data_dir(
328 claude_dir.path().to_path_buf(),
329 codex_dir.path().to_path_buf(),
330 )
331 .expect("config");
332
333 let mut engine = SqlEngine::new(config, SqlOptions::default()).expect("engine");
334
335 let rows = engine
336 .execute("SELECT display, session_id, timestamp FROM jhistory ORDER BY timestamp DESC")
337 .await
338 .expect("query");
339
340 assert_eq!(rows.len(), 2);
341 assert_eq!(rows[0]["display"], serde_json::json!("second prompt"));
342 assert_eq!(rows[0]["session_id"], serde_json::json!("s2"));
343 assert_eq!(
344 rows[0]["timestamp"],
345 serde_json::json!(1_700_000_001_000_i64)
346 );
347 }
348
349 #[tokio::test]
350 async fn test_codex_history_alias_queries_same_data() {

Callers

nothing calls this directly

Calls 3

pathMethod · 0.80
writeFunction · 0.70
executeMethod · 0.45

Tested by

no test coverage detected