()
| 420 | |
| 421 | #[test] |
| 422 | fn test_kg_fts_search() { |
| 423 | let dir = tempdir().unwrap(); |
| 424 | let pristine = Pristine::open(dir.path().join("db")).unwrap(); |
| 425 | let mut txn = pristine.write_txn().unwrap(); |
| 426 | txn.init_kg().unwrap(); |
| 427 | |
| 428 | txn.upsert_kg_node( |
| 429 | &KgNode::new("change:abc", "change", "abc123", "graph") |
| 430 | .with_summary("Fix authentication bug"), |
| 431 | ) |
| 432 | .unwrap(); |
| 433 | txn.upsert_kg_node( |
| 434 | &KgNode::new("change:def", "change", "def456", "graph").with_summary("Add logging"), |
| 435 | ) |
| 436 | .unwrap(); |
| 437 | |
| 438 | // Search for "authentication" |
| 439 | let results = txn.kg_fts_search("authentication", 10).unwrap(); |
| 440 | assert_eq!(results.len(), 1); |
| 441 | assert_eq!(results[0].id, "change:abc"); |
| 442 | |
| 443 | // Search for "fix" matches abc's summary |
| 444 | let results = txn.kg_fts_search("fix", 10).unwrap(); |
| 445 | assert_eq!(results.len(), 1); |
| 446 | assert_eq!(results[0].id, "change:abc"); |
| 447 | |
| 448 | // Search for "logging" matches def |
| 449 | let results = txn.kg_fts_search("logging", 10).unwrap(); |
| 450 | assert_eq!(results.len(), 1); |
| 451 | assert_eq!(results[0].id, "change:def"); |
| 452 | |
| 453 | txn.commit().unwrap(); |
| 454 | } |
| 455 | |
| 456 | #[test] |
| 457 | fn test_kg_del_node_cascades_edges() { |
nothing calls this directly
no test coverage detected