| 1 | package builtincontent_test |
| 2 | |
| 3 | import ( |
| 4 | "strings" |
| 5 | "testing" |
| 6 | |
| 7 | "reasonix/internal/skill/builtincontent" |
| 8 | ) |
| 9 | |
| 10 | func TestLoadReasonixGuide(t *testing.T) { |
| 11 | sk, err := builtincontent.LoadReasonixGuide() |
| 12 | if err != nil { |
| 13 | t.Fatal(err) |
| 14 | } |
| 15 | if sk.Name != "reasonix-guide" { |
| 16 | t.Fatalf("name = %q", sk.Name) |
| 17 | } |
| 18 | if sk.Description == "" { |
| 19 | t.Fatal("missing description") |
| 20 | } |
| 21 | if sk.RunAs != "inline" { |
| 22 | t.Fatalf("runAs = %q, want inline", sk.RunAs) |
| 23 | } |
| 24 | if !strings.Contains(sk.Body, "reasonix doctor capabilities") { |
| 25 | t.Fatal("body should recommend doctor capabilities") |
| 26 | } |
| 27 | if strings.Contains(strings.ToLower(sk.Frontmatter["auto-use"]), "require") { |
| 28 | t.Fatal("guide must not set auto-use require") |
| 29 | } |
| 30 | } |
| 31 | |
| 32 | func TestParseSkillMarkdownStable(t *testing.T) { |
| 33 | raw := "---\nname: demo\ndescription: d\nrunAs: inline\n---\n\n# hi\n" |
| 34 | a, err := builtincontent.ParseSkillMarkdown("demo/SKILL.md", raw) |
| 35 | if err != nil { |
| 36 | t.Fatal(err) |
| 37 | } |
| 38 | b, err := builtincontent.ParseSkillMarkdown("demo/SKILL.md", raw) |
| 39 | if err != nil { |
| 40 | t.Fatal(err) |
| 41 | } |
| 42 | if a.Body != b.Body || a.Description != b.Description { |
| 43 | t.Fatal("parse not deterministic") |
| 44 | } |
| 45 | } |
| 46 |