Keep source, config, and deploy files. Leave runtime data, uploads, and logs out of git. Co-authored-by: Cursor <cursoragent@cursor.com>
61 lines
2.2 KiB
Python
61 lines
2.2 KiB
Python
import pytest
|
|
|
|
from kamidso.repositories.store import RepositoryStore
|
|
from kamidso.resources.enterprise_skills import ENTERPRISE_SKILLS, SKILL_ORDER
|
|
from kamidso.resources.skills import SkillCatalog, parse_skill_frontmatter, scan_skill_packages
|
|
|
|
|
|
def test_parse_skill_frontmatter():
|
|
text = """---
|
|
name: sales-intelligence
|
|
description: Analyze company sales
|
|
---
|
|
|
|
# Title
|
|
"""
|
|
meta = parse_skill_frontmatter(text)
|
|
assert meta["name"] == "sales-intelligence"
|
|
assert "sales" in meta["description"]
|
|
|
|
|
|
def test_scan_repo_skills_includes_enterprise_catalog():
|
|
skills = scan_skill_packages()
|
|
ids = [item["id"] for item in skills]
|
|
assert ids == list(SKILL_ORDER)
|
|
assert "skill-creator" not in ids
|
|
assert "csv-data-analysis" not in ids
|
|
assert len(ids) == 10
|
|
sales = next(item for item in skills if item["id"] == "sales-intelligence")
|
|
assert sales["name"] == "هوش فروش"
|
|
assert sales["category_id"] == "finance"
|
|
assert sales["reasoning_minimum"] == "medium"
|
|
|
|
|
|
@pytest.mark.asyncio
|
|
async def test_skill_catalog_syncs_to_store():
|
|
store = RepositoryStore()
|
|
catalog = SkillCatalog(store)
|
|
public = await catalog.list_public()
|
|
assert len(public) == 10
|
|
assert any(item["id"] == "sales-intelligence" and item["name"] == "هوش فروش" for item in public)
|
|
stored = await store.list_skills()
|
|
assert stored
|
|
assert len(ENTERPRISE_SKILLS) == 10
|
|
|
|
|
|
def test_catalog_descriptions_are_self_contained():
|
|
from kamidso.resources import enterprise_skills as catalog
|
|
|
|
ids = {item["id"] for item in ENTERPRISE_SKILLS}
|
|
sales = next(item for item in ENTERPRISE_SKILLS if item["id"] == "sales-intelligence")
|
|
root = next(item for item in ENTERPRISE_SKILLS if item["id"] == "root-cause-investigator")
|
|
assert "رتبه" in sales["description"] or "اندازه" in sales["description"]
|
|
assert "علت" in root["description"]
|
|
for item in ENTERPRISE_SKILLS:
|
|
assert len(item["description"]) > 80
|
|
for other_id in ids:
|
|
if other_id != item["id"]:
|
|
assert other_id not in item["description"]
|
|
assert not hasattr(catalog, "match_public_skill")
|
|
assert not hasattr(catalog, "plan_skills_for_turn")
|