fix(skills): 合并兼容 - 替换已删除种子回归夹具
This commit is contained in:
1 parent
7fec0484e6
commit
423291247a
1 file changed
+14
-17
@@ -3,7 +3,6 @@ package skills
|
|||||||
import (
|
import (
|
||||||
"archive/zip"
|
"archive/zip"
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
@@ -28,25 +27,23 @@ func TestArchiveFromMarkdownInfersMetadata(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestReportedBuiltinSkillPackage(t *testing.T) {
|
func TestBuiltinSkillPackageBoundsMetadata(t *testing.T) {
|
||||||
var definitions []builtinSkillDefinition
|
skill := builtinSkillDefinition{
|
||||||
if err := json.Unmarshal(builtinSkillsJSON, &definitions); err != nil {
|
SkillID: "test-builtin-skill",
|
||||||
|
SkillName: "测试技能",
|
||||||
|
Description: strings.Repeat("描述内容。", 140),
|
||||||
|
Instruction: "# 测试技能\n\n保留完整正文。\n",
|
||||||
|
}
|
||||||
|
archive, err := archiveFromMarkdown([]byte(skill.Instruction), skill.SkillName, skill.Description)
|
||||||
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
for _, skill := range definitions {
|
if got := len([]rune(archive.Metadata.Description)); got > 500 {
|
||||||
if skill.SkillID != "16000000000049" {
|
t.Fatalf("builtin skill metadata description length = %d, want <= 500", got)
|
||||||
continue
|
}
|
||||||
}
|
if string(archive.Files["SKILL.md"]) != skill.Instruction {
|
||||||
archive, err := archiveFromMarkdown([]byte(skill.Instruction), skill.SkillName, skill.Description)
|
t.Fatal("builtin skill package must preserve the complete instruction")
|
||||||
if err != nil {
|
|
||||||
t.Fatal(err)
|
|
||||||
}
|
|
||||||
if len([]rune(archive.Metadata.Description)) != 500 || string(archive.Files["SKILL.md"]) != skill.Instruction {
|
|
||||||
t.Fatal("reported skill must have bounded metadata and unchanged instruction")
|
|
||||||
}
|
|
||||||
return
|
|
||||||
}
|
}
|
||||||
t.Fatal("reported builtin skill is missing")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEnsureSkillPackagesBoundsLegacyFallbackMetadata(t *testing.T) {
|
func TestEnsureSkillPackagesBoundsLegacyFallbackMetadata(t *testing.T) {
|
||||||
|
|||||||
Reference in new issue
Block a user