()
| 1483 | |
| 1484 | #[test] |
| 1485 | fn test_intent_create() { |
| 1486 | let dir = tempdir().unwrap(); |
| 1487 | let repo = init_repo_with_vault(dir.path()); |
| 1488 | |
| 1489 | let result = repo |
| 1490 | .vault_intent_create(IntentCreateOptions { |
| 1491 | title: "Fix authentication".to_string(), |
| 1492 | priority: Some("high".to_string()), |
| 1493 | assignee: Some("alice".to_string()), |
| 1494 | labels: vec!["auth".to_string(), "security".to_string()], |
| 1495 | session_id: Some("sess-abc".to_string()), |
| 1496 | turn_id: Some(1), |
| 1497 | kind: None, |
| 1498 | }) |
| 1499 | .unwrap(); |
| 1500 | |
| 1501 | // Human key ends with the per-author seq (`::1`); the ULID is the id. |
| 1502 | assert!(result.id.ends_with("::1"), "human key was: {}", result.id); |
| 1503 | assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID"); |
| 1504 | // Path is flat and ULID-scoped. |
| 1505 | assert_eq!( |
| 1506 | result.intent_file, |
| 1507 | format!("intents/{}/intent.md", result.uid), |
| 1508 | "Path was: {}", |
| 1509 | result.intent_file |
| 1510 | ); |
| 1511 | assert_eq!(result.view_name, repo.current_view()); |
| 1512 | |
| 1513 | // Should be in manifest, keyed by the human key. |
| 1514 | let manifest = repo.vault_manifest().unwrap(); |
| 1515 | assert!(manifest.intents.contains_key(&result.id)); |
| 1516 | assert_eq!(manifest.intents[&result.id].priority, "high"); |
| 1517 | assert_eq!(manifest.intents[&result.id].title, "Fix authentication"); |
| 1518 | assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file); |
| 1519 | assert_eq!(manifest.intents[&result.id].uid, result.uid); |
| 1520 | assert_eq!(manifest.intents[&result.id].seq, 1); |
| 1521 | |
| 1522 | // File should exist on disk |
| 1523 | assert!(repo.vault_dir().join(&result.intent_file).exists()); |
| 1524 | } |
| 1525 | |
| 1526 | #[test] |
| 1527 | fn test_intent_create_auto_increment() { |
nothing calls this directly
no test coverage detected