()
| 1506 | |
| 1507 | #[test] |
| 1508 | fn test_intent_create() { |
| 1509 | let dir = tempdir().unwrap(); |
| 1510 | let repo = init_repo_with_vault(dir.path()); |
| 1511 | |
| 1512 | let result = repo |
| 1513 | .vault_intent_create(IntentCreateOptions { |
| 1514 | title: "Fix authentication".to_string(), |
| 1515 | priority: Some("high".to_string()), |
| 1516 | assignee: Some("alice".to_string()), |
| 1517 | labels: vec!["auth".to_string(), "security".to_string()], |
| 1518 | session_id: Some("sess-abc".to_string()), |
| 1519 | turn_id: Some(1), |
| 1520 | kind: None, |
| 1521 | }) |
| 1522 | .unwrap(); |
| 1523 | |
| 1524 | // Human key ends with the per-author seq (`::1`); the ULID is the id. |
| 1525 | assert!(result.id.ends_with("::1"), "human key was: {}", result.id); |
| 1526 | assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID"); |
| 1527 | // Path is flat and ULID-scoped. |
| 1528 | assert_eq!( |
| 1529 | result.intent_file, |
| 1530 | format!("intents/{}/intent.md", result.uid), |
| 1531 | "Path was: {}", |
| 1532 | result.intent_file |
| 1533 | ); |
| 1534 | assert_eq!(result.view_name, repo.current_view()); |
| 1535 | |
| 1536 | // Should be in manifest, keyed by the human key. |
| 1537 | let manifest = repo.vault_manifest().unwrap(); |
| 1538 | assert!(manifest.intents.contains_key(&result.id)); |
| 1539 | assert_eq!(manifest.intents[&result.id].priority, "high"); |
| 1540 | assert_eq!(manifest.intents[&result.id].title, "Fix authentication"); |
| 1541 | assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file); |
| 1542 | assert_eq!(manifest.intents[&result.id].uid, result.uid); |
| 1543 | assert_eq!(manifest.intents[&result.id].seq, 1); |
| 1544 | |
| 1545 | // File should exist on disk |
| 1546 | assert!(repo.vault_dir().join(&result.intent_file).exists()); |
| 1547 | } |
| 1548 | |
| 1549 | #[test] |
| 1550 | fn test_intent_create_auto_increment() { |
nothing calls this directly
no test coverage detected