()
| 539 | |
| 540 | #[test] |
| 541 | fn test_load_from_dir() -> anyhow::Result<()> { |
| 542 | let temp_dir = TempDir::new()?; |
| 543 | |
| 544 | // Create a valid skill file |
| 545 | let skill_path = temp_dir.path().join("test-skill.md"); |
| 546 | let mut file = std::fs::File::create(&skill_path)?; |
| 547 | writeln!(file, "---")?; |
| 548 | writeln!(file, "name: test-skill")?; |
| 549 | writeln!(file, "description: A test skill")?; |
| 550 | writeln!(file, "kind: instruction")?; |
| 551 | writeln!(file, "---")?; |
| 552 | writeln!(file, "# Test Skill")?; |
| 553 | writeln!(file, "This is a test skill.")?; |
| 554 | drop(file); |
| 555 | |
| 556 | // Create a non-skill .md file (should be skipped) |
| 557 | let readme_path = temp_dir.path().join("README.md"); |
| 558 | std::fs::write(&readme_path, "# README\nNot a skill")?; |
| 559 | |
| 560 | // Create a non-.md file (should be skipped) |
| 561 | let txt_path = temp_dir.path().join("notes.txt"); |
| 562 | std::fs::write(&txt_path, "Some notes")?; |
| 563 | |
| 564 | let registry = SkillRegistry::new(); |
| 565 | let loaded = registry.load_from_dir(temp_dir.path())?; |
| 566 | |
| 567 | assert_eq!(loaded, 1); |
| 568 | assert_eq!(registry.len(), 1); |
| 569 | assert!(registry.get("test-skill").is_some()); |
| 570 | |
| 571 | Ok(()) |
| 572 | } |
| 573 | |
| 574 | #[test] |
| 575 | fn test_load_from_dir_recurses_into_nested_skill_dirs() -> anyhow::Result<()> { |
nothing calls this directly
no test coverage detected