MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_intent_create

Function test_intent_create

atomic-repository/src/repository/vault_intent.rs:1056–1094  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1054
1055 #[test]
1056 fn test_intent_create() {
1057 let dir = tempdir().unwrap();
1058 let repo = init_repo_with_vault(dir.path());
1059
1060 let result = repo
1061 .vault_intent_create(IntentCreateOptions {
1062 title: "Fix authentication".to_string(),
1063 priority: Some("high".to_string()),
1064 assignee: Some("alice".to_string()),
1065 labels: vec!["auth".to_string(), "security".to_string()],
1066 session_id: Some("sess-abc".to_string()),
1067 turn_id: Some(1),
1068 })
1069 .unwrap();
1070
1071 // Human key ends with the per-author seq (`::1`); the ULID is the id.
1072 assert!(result.id.ends_with("::1"), "human key was: {}", result.id);
1073 assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID");
1074 // Path is flat and ULID-scoped.
1075 assert_eq!(
1076 result.intent_file,
1077 format!("intents/{}/intent.md", result.uid),
1078 "Path was: {}",
1079 result.intent_file
1080 );
1081 assert_eq!(result.view_name, repo.current_view());
1082
1083 // Should be in manifest, keyed by the human key.
1084 let manifest = repo.vault_manifest().unwrap();
1085 assert!(manifest.intents.contains_key(&result.id));
1086 assert_eq!(manifest.intents[&result.id].priority, "high");
1087 assert_eq!(manifest.intents[&result.id].title, "Fix authentication");
1088 assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file);
1089 assert_eq!(manifest.intents[&result.id].uid, result.uid);
1090 assert_eq!(manifest.intents[&result.id].seq, 1);
1091
1092 // File should exist on disk
1093 assert!(repo.vault_dir().join(&result.intent_file).exists());
1094 }
1095
1096 #[test]
1097 fn test_intent_create_auto_increment() {

Callers

nothing calls this directly

Calls 5

init_repo_with_vaultFunction · 0.85
vault_intent_createMethod · 0.80
vault_manifestMethod · 0.80
unwrapMethod · 0.45
pathMethod · 0.45

Tested by

no test coverage detected