(t *testing.T)
| 124 | } |
| 125 | |
| 126 | func TestLoadSkillBody(t *testing.T) { |
| 127 | t.Parallel() |
| 128 | |
| 129 | t.Run("ReturnsBodyAndFiles", func(t *testing.T) { |
| 130 | t.Parallel() |
| 131 | |
| 132 | ctrl := gomock.NewController(t) |
| 133 | conn := agentconnmock.NewMockAgentConn(ctrl) |
| 134 | |
| 135 | skill := chattool.SkillMeta{ |
| 136 | Name: "my-skill", |
| 137 | Description: "desc", |
| 138 | Dir: "/work/.agents/skills/my-skill", |
| 139 | } |
| 140 | |
| 141 | // Read the full SKILL.md. |
| 142 | conn.EXPECT().ReadFile( |
| 143 | gomock.Any(), |
| 144 | "/work/.agents/skills/my-skill/SKILL.md", |
| 145 | int64(0), |
| 146 | int64(64*1024+1), |
| 147 | ).Return( |
| 148 | io.NopCloser(strings.NewReader(validSkillMD("my-skill", "desc"))), |
| 149 | "text/markdown", |
| 150 | nil, |
| 151 | ) |
| 152 | |
| 153 | // List supporting files. |
| 154 | conn.EXPECT().LS(gomock.Any(), "", gomock.Any()).Return( |
| 155 | workspacesdk.LSResponse{ |
| 156 | Contents: []workspacesdk.LSFile{ |
| 157 | {Name: "SKILL.md"}, |
| 158 | {Name: "helper.md"}, |
| 159 | {Name: "roles", IsDir: true}, |
| 160 | }, |
| 161 | }, nil, |
| 162 | ) |
| 163 | |
| 164 | content, err := chattool.LoadSkillBody(context.Background(), conn, skill, "SKILL.md") |
| 165 | require.NoError(t, err) |
| 166 | assert.Contains(t, content.Body, "Do the thing.") |
| 167 | assert.Equal(t, []string{"helper.md", "roles/"}, content.Files) |
| 168 | }) |
| 169 | } |
| 170 | |
| 171 | func TestLoadSkillFile(t *testing.T) { |
| 172 | t.Parallel() |
nothing calls this directly
no test coverage detected