()
| 852 | |
| 853 | #[test] |
| 854 | fn test_intent_create() { |
| 855 | let dir = tempdir().unwrap(); |
| 856 | let repo = init_repo_with_vault(dir.path()); |
| 857 | |
| 858 | let result = repo |
| 859 | .vault_intent_create(IntentCreateOptions { |
| 860 | title: "Fix authentication".to_string(), |
| 861 | priority: Some("high".to_string()), |
| 862 | assignee: Some("alice".to_string()), |
| 863 | labels: vec!["auth".to_string(), "security".to_string()], |
| 864 | session_id: Some("sess-abc".to_string()), |
| 865 | turn_id: Some(1), |
| 866 | }) |
| 867 | .unwrap(); |
| 868 | |
| 869 | // ID should be PREFIX-1 |
| 870 | assert!(result.id.ends_with("-1"), "ID was: {}", result.id); |
| 871 | // Path should be view-scoped and session-scoped |
| 872 | assert!( |
| 873 | result.intent_file.contains("/sess-abc/1/intent.md"), |
| 874 | "Path was: {}", |
| 875 | result.intent_file |
| 876 | ); |
| 877 | assert_eq!(result.view_name, repo.current_view()); |
| 878 | |
| 879 | // Should be in manifest |
| 880 | let manifest = repo.vault_manifest().unwrap(); |
| 881 | assert!(manifest.intents.contains_key(&result.id)); |
| 882 | assert_eq!(manifest.intents[&result.id].priority, "high"); |
| 883 | assert_eq!(manifest.intents[&result.id].title, "Fix authentication"); |
| 884 | assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file); |
| 885 | assert_eq!(manifest.next_intent_id, 2); |
| 886 | |
| 887 | // File should exist on disk |
| 888 | assert!(repo.vault_dir().join(&result.intent_file).exists()); |
| 889 | } |
| 890 | |
| 891 | #[test] |
| 892 | fn test_intent_create_auto_increment() { |
nothing calls this directly
no test coverage detected