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

Function test_intent_create

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

Source from the content-addressed store, hash-verified

1483
1484 #[test]
1485 fn test_intent_create() {
1486 let dir = tempdir().unwrap();
1487 let repo = init_repo_with_vault(dir.path());
1488
1489 let result = repo
1490 .vault_intent_create(IntentCreateOptions {
1491 title: "Fix authentication".to_string(),
1492 priority: Some("high".to_string()),
1493 assignee: Some("alice".to_string()),
1494 labels: vec!["auth".to_string(), "security".to_string()],
1495 session_id: Some("sess-abc".to_string()),
1496 turn_id: Some(1),
1497 kind: None,
1498 })
1499 .unwrap();
1500
1501 // Human key ends with the per-author seq (`::1`); the ULID is the id.
1502 assert!(result.id.ends_with("::1"), "human key was: {}", result.id);
1503 assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID");
1504 // Path is flat and ULID-scoped.
1505 assert_eq!(
1506 result.intent_file,
1507 format!("intents/{}/intent.md", result.uid),
1508 "Path was: {}",
1509 result.intent_file
1510 );
1511 assert_eq!(result.view_name, repo.current_view());
1512
1513 // Should be in manifest, keyed by the human key.
1514 let manifest = repo.vault_manifest().unwrap();
1515 assert!(manifest.intents.contains_key(&result.id));
1516 assert_eq!(manifest.intents[&result.id].priority, "high");
1517 assert_eq!(manifest.intents[&result.id].title, "Fix authentication");
1518 assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file);
1519 assert_eq!(manifest.intents[&result.id].uid, result.uid);
1520 assert_eq!(manifest.intents[&result.id].seq, 1);
1521
1522 // File should exist on disk
1523 assert!(repo.vault_dir().join(&result.intent_file).exists());
1524 }
1525
1526 #[test]
1527 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