feat(fmt): Fix fmt
This commit is contained in:
parent
4f34d6346c
commit
68f015ddb3
2 changed files with 27 additions and 9 deletions
|
|
@ -254,7 +254,7 @@ func (sl *SkillsLoader) getSkillMetadata(skillPath string) *SkillMetadata {
|
||||||
content, err := os.ReadFile(skillPath)
|
content, err := os.ReadFile(skillPath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.WarnCF("skills", "Failed to read skill metadata",
|
logger.WarnCF("skills", "Failed to read skill metadata",
|
||||||
map[string]interface{}{
|
map[string]any{
|
||||||
"skill_path": skillPath,
|
"skill_path": skillPath,
|
||||||
"error": err.Error(),
|
"error": err.Error(),
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -80,11 +80,11 @@ func TestExtractFrontmatter(t *testing.T) {
|
||||||
sl := &SkillsLoader{}
|
sl := &SkillsLoader{}
|
||||||
|
|
||||||
testcases := []struct {
|
testcases := []struct {
|
||||||
name string
|
name string
|
||||||
content string
|
content string
|
||||||
expectedName string
|
expectedName string
|
||||||
expectedDesc string
|
expectedDesc string
|
||||||
lineEndingType string
|
lineEndingType string
|
||||||
}{
|
}{
|
||||||
{
|
{
|
||||||
name: "unix-line-endings",
|
name: "unix-line-endings",
|
||||||
|
|
@ -117,8 +117,20 @@ func TestExtractFrontmatter(t *testing.T) {
|
||||||
|
|
||||||
// Parse YAML to get name and description (parseSimpleYAML now handles all line ending types)
|
// Parse YAML to get name and description (parseSimpleYAML now handles all line ending types)
|
||||||
yamlMeta := sl.parseSimpleYAML(frontmatter)
|
yamlMeta := sl.parseSimpleYAML(frontmatter)
|
||||||
assert.Equal(t, tc.expectedName, yamlMeta["name"], "Name should be correctly parsed from frontmatter with %s line endings", tc.lineEndingType)
|
assert.Equal(
|
||||||
assert.Equal(t, tc.expectedDesc, yamlMeta["description"], "Description should be correctly parsed from frontmatter with %s line endings", tc.lineEndingType)
|
t,
|
||||||
|
tc.expectedName,
|
||||||
|
yamlMeta["name"],
|
||||||
|
"Name should be correctly parsed from frontmatter with %s line endings",
|
||||||
|
tc.lineEndingType,
|
||||||
|
)
|
||||||
|
assert.Equal(
|
||||||
|
t,
|
||||||
|
tc.expectedDesc,
|
||||||
|
yamlMeta["description"],
|
||||||
|
"Description should be correctly parsed from frontmatter with %s line endings",
|
||||||
|
tc.lineEndingType,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -173,7 +185,13 @@ func TestStripFrontmatter(t *testing.T) {
|
||||||
for _, tc := range testcases {
|
for _, tc := range testcases {
|
||||||
t.Run(tc.name, func(t *testing.T) {
|
t.Run(tc.name, func(t *testing.T) {
|
||||||
result := sl.stripFrontmatter(tc.content)
|
result := sl.stripFrontmatter(tc.content)
|
||||||
assert.Equal(t, tc.expectedContent, result, "Frontmatter should be stripped correctly for %s", tc.lineEndingType)
|
assert.Equal(
|
||||||
|
t,
|
||||||
|
tc.expectedContent,
|
||||||
|
result,
|
||||||
|
"Frontmatter should be stripped correctly for %s",
|
||||||
|
tc.lineEndingType,
|
||||||
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue