()
| 806 | |
| 807 | #[test] |
| 808 | fn test_intent_create() { |
| 809 | let dir = tempdir().unwrap(); |
| 810 | let repo = init_repo_with_vault(dir.path()); |
| 811 | |
| 812 | let result = repo |
| 813 | .vault_intent_create(IntentCreateOptions { |
| 814 | title: "Fix authentication".to_string(), |
| 815 | priority: Some("high".to_string()), |
| 816 | assignee: Some("alice".to_string()), |
| 817 | labels: vec!["auth".to_string(), "security".to_string()], |
| 818 | session_id: Some("sess-abc".to_string()), |
| 819 | turn_id: Some(1), |
| 820 | }) |
| 821 | .unwrap(); |
| 822 | |
| 823 | // ID should be PREFIX-1 |
| 824 | assert!(result.id.ends_with("-1"), "ID was: {}", result.id); |
| 825 | // Path should be view-scoped and session-scoped |
| 826 | assert!( |
| 827 | result.intent_file.contains("/sess-abc/1/intent.md"), |
| 828 | "Path was: {}", |
| 829 | result.intent_file |
| 830 | ); |
| 831 | assert_eq!(result.view_name, repo.current_view()); |
| 832 | |
| 833 | // Should be in manifest |
| 834 | let manifest = repo.vault_manifest().unwrap(); |
| 835 | assert!(manifest.intents.contains_key(&result.id)); |
| 836 | assert_eq!(manifest.intents[&result.id].priority, "high"); |
| 837 | assert_eq!(manifest.intents[&result.id].title, "Fix authentication"); |
| 838 | assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file); |
| 839 | assert_eq!(manifest.next_intent_id, 2); |
| 840 | |
| 841 | // File should exist on disk |
| 842 | assert!(repo.vault_dir().join(&result.intent_file).exists()); |
| 843 | } |
| 844 | |
| 845 | #[test] |
| 846 | fn test_intent_create_auto_increment() { |
nothing calls this directly
no test coverage detected