use std::path::PathBuf;
use pretty_assertions::assert_eq;
use super::*;
fn skill(name: &str, source: SkillSource, disable_model_invocation: bool) -> Skill {
Skill {
name: name.to_owned(),
description: format!("{name} skill"),
disable_model_invocation,
source,
contents: String::new(),
}
}
#[test]
fn an_agent_is_listed_the_skills_it_does_not_find_itself() {
let skills = vec![
skill("built-in", SkillSource::BuiltIn, false),
skill(
"loose",
SkillSource::Filesystem {
skill_file: PathBuf::from("/home/user/.agents/skills/loose/SKILL.md"),
owner: None,
},
false,
),
skill(
"plugin",
SkillSource::plugin(
PathBuf::from("/home/user/.agents/plugins/kit/skills/plugin/SKILL.md"),
"kit".to_owned(),
),
false,
),
skill("person-only", SkillSource::BuiltIn, true),
];
let names = |files: SkillFiles| -> Vec<String> {
listed_skills(&skills, files)
.into_iter()
.map(|skill| skill.name)
.collect()
};
assert_eq!(
[
names(SkillFiles::FromRho),
names(SkillFiles::LooseReadByAgent)
],
[
vec![
"built-in".to_owned(),
"loose".to_owned(),
"plugin".to_owned()
],
vec!["built-in".to_owned(), "plugin".to_owned()],
]
);
}