feat(skills): 技能管理 - 增加可选的平台子分类策展 (#693)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Catlaxy AI
2026-10-06 09:24:21 +08:00
committed by GitHub
parent 5976389ed4
commit c963fc7b89
32 changed files with 981 additions and 24 deletions

View File

@@ -0,0 +1,20 @@
import { describe, expect, test } from "bun:test";
import { curationQuery, matchesCuration } from "../src/components/skills/skill-curation-browser";
import type { SkillCuration } from "../src/services/api/skill-curation";
import type { Skill } from "../src/services/api/skills";
describe("platform curation", () => {
const data: SkillCuration = { enabled: false, revision: 0, categories: [], assignments: [{ skillId: "one", categoryId: "child" }] };
const skill = { skillId: "one", tag: "drama" } as Skill;
test("disabled mode preserves existing requests and visible skills", () => {
expect(curationQuery(data, "child")).toEqual({});
expect(matchesCuration(skill, data, "missing")).toBe(true);
});
test("enabled mode filters by assignment and includes unassigned skills", () => {
const enabled = { ...data, enabled: true };
expect(curationQuery(enabled, "child")).toEqual({ platformCategoryId: "child" });
expect(matchesCuration(skill, enabled, "child")).toBe(true);
expect(matchesCuration(skill, enabled, "__uncategorized__")).toBe(false);
expect(matchesCuration({ ...skill, skillId: "two" }, enabled, "__uncategorized__")).toBe(true);
});
});