mirror of
https://github.com/runkids/skillshare.git
synced 2026-11-20 20:34:19 +00:00
test(api): cover skillsSharedWith in the targets list
Code review of the target-page warning found the new targets API field only had a unit test on the config helper. The handler is what the UI reads, so check that it names targets writing the same skills folder and leaves out one that writes elsewhere. Release-As: 0.25.4
This commit is contained in:
@@ -44,6 +44,7 @@ type skillsTargetItem struct {
|
||||
SkillsEnabled bool `json:"skillsEnabled"`
|
||||
SkillsReadFrom []string `json:"skillsReadFrom"`
|
||||
SkillsAlsoReadBy []string `json:"skillsAlsoReadBy"`
|
||||
SkillsSharedWith []string `json:"skillsSharedWith"`
|
||||
LinkedCount int `json:"linkedCount"`
|
||||
}
|
||||
|
||||
@@ -99,6 +100,19 @@ func TestSkillsOffPreview_SharedFolder(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestListTargets_NamesTargetsSharingASkillsFolder(t *testing.T) {
|
||||
shared := filepath.Join(t.TempDir(), "agents", "skills")
|
||||
s, _ := newTestServerWithTargets(t, map[string]string{"universal": shared, "codex": shared, "claude": filepath.Join(t.TempDir(), "claude", "skills")})
|
||||
|
||||
items := listSkillsTargets(t, s)
|
||||
if !slices.Equal(items["universal"].SkillsSharedWith, []string{"codex"}) || !slices.Equal(items["codex"].SkillsSharedWith, []string{"universal"}) {
|
||||
t.Errorf("universal = %+v, codex = %+v", items["universal"], items["codex"])
|
||||
}
|
||||
if len(items["claude"].SkillsSharedWith) != 0 {
|
||||
t.Errorf("claude = %+v, want no sharing", items["claude"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestUpdateTarget_SkillsOffDetachesAndPersists(t *testing.T) {
|
||||
s, _, _, gemini := newSkillsOffServer(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user