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

Function test_intent_create

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

Source from the content-addressed store, hash-verified

1623
1624 #[test]
1625 fn test_intent_create() {
1626 let dir = tempdir().unwrap();
1627 let repo = init_repo_with_vault(dir.path());
1628
1629 let result = repo
1630 .vault_intent_create(IntentCreateOptions {
1631 title: "Fix authentication".to_string(),
1632 priority: Some("high".to_string()),
1633 assignee: Some("alice".to_string()),
1634 labels: vec!["auth".to_string(), "security".to_string()],
1635 session_id: Some("sess-abc".to_string()),
1636 turn_id: Some(1),
1637 kind: None,
1638 })
1639 .unwrap();
1640
1641 // Human key ends with the per-author seq (`::1`); the ULID is the id.
1642 assert!(result.id.ends_with("::1"), "human key was: {}", result.id);
1643 assert_eq!(result.uid.len(), 26, "uid should be a 26-char ULID");
1644 // Path is flat and ULID-scoped.
1645 assert_eq!(
1646 result.intent_file,
1647 format!("intents/{}/intent.md", result.uid),
1648 "Path was: {}",
1649 result.intent_file
1650 );
1651 assert_eq!(result.view_name, repo.current_view());
1652
1653 // Should be in manifest, keyed by the human key.
1654 let manifest = repo.vault_manifest().unwrap();
1655 assert!(manifest.intents.contains_key(&result.id));
1656 assert_eq!(manifest.intents[&result.id].priority, "high");
1657 assert_eq!(manifest.intents[&result.id].title, "Fix authentication");
1658 assert_eq!(manifest.intents[&result.id].vault_path, result.intent_file);
1659 assert_eq!(manifest.intents[&result.id].uid, result.uid);
1660 assert_eq!(manifest.intents[&result.id].seq, 1);
1661
1662 // File should exist on disk
1663 assert!(repo.vault_dir().join(&result.intent_file).exists());
1664 }
1665
1666 #[test]
1667 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