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

Function test_intent_create

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

Source from the content-addressed store, hash-verified

1245
1246 #[test]
1247 fn test_intent_create() {
1248 let dir = tempdir().unwrap();
1249 let repo = init_repo_with_vault(dir.path());
1250
1251 let result = repo
1252 .vault_intent_create(IntentCreateOptions {
1253 title: "Fix authentication".to_string(),
1254 priority: Some("high".to_string()),
1255 assignee: Some("alice".to_string()),
1256 labels: vec!["auth".to_string(), "security".to_string()],
1257 session_id: Some("sess-abc".to_string()),
1258 turn_id: Some(1),
1259 })
1260 .unwrap();
1261
1262 // Human key ends with the per-author seq (`::1`); the ULID is the id.
1263 assert!(result.id.ends_with("::1"), "human key was: {}", result.id);
1264 assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID");
1265 // Path is flat and ULID-scoped.
1266 assert_eq!(
1267 result.intent_file,
1268 format!("intents/{}/intent.md", result.uid),
1269 "Path was: {}",
1270 result.intent_file
1271 );
1272 assert_eq!(result.view_name, repo.current_view());
1273
1274 // Should be in manifest, keyed by the human key.
1275 let manifest = repo.vault_manifest().unwrap();
1276 assert!(manifest.intents.contains_key(&result.id));
1277 assert_eq!(manifest.intents[&result.id].priority, "high");
1278 assert_eq!(manifest.intents[&result.id].title, "Fix authentication");
1279 assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file);
1280 assert_eq!(manifest.intents[&result.id].uid, result.uid);
1281 assert_eq!(manifest.intents[&result.id].seq, 1);
1282
1283 // File should exist on disk
1284 assert!(repo.vault_dir().join(&result.intent_file).exists());
1285 }
1286
1287 #[test]
1288 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