Files
skillshare/tests/integration/status_project_test.go
T
Willie 880dad5c22 fix(status,list): show unreadable git status as unknown instead of clean
status and list discarded the error from the uncommitted-changes check,
so a tracked repo whose git status could not be read was shown as
up-to-date. They now show it as unknown with a warning naming the repo
and error; status --json sets the existing status and message fields.
The commands still succeed, since they only report.
2026-09-30 02:26:24 +08:00

60 lines
1.8 KiB
Go

//go:build !online
package integration
import (
"path/filepath"
"testing"
"skillshare/internal/testutil"
)
func TestStatusProject_ShowsSyncedTargets(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
projectRoot := sb.SetupProjectDir("claude", "cursor")
sb.CreateProjectSkill(projectRoot, "skill-a", map[string]string{"SKILL.md": "# A"})
// Sync first
sb.RunCLIInDir(projectRoot, "sync", "-p").AssertSuccess(t)
result := sb.RunCLIInDir(projectRoot, "status", "-p")
result.AssertSuccess(t)
result.AssertOutputContains(t, "merged")
result.AssertOutputContains(t, "1 shared")
}
func TestStatusProject_ShowsUnsynced(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
projectRoot := sb.SetupProjectDir("claude")
sb.CreateProjectSkill(projectRoot, "unsynced", map[string]string{"SKILL.md": "# U"})
// Don't sync — should show "has files" (target dir exists but no symlinks)
result := sb.RunCLIInDir(projectRoot, "status", "-p")
result.AssertSuccess(t)
result.AssertOutputContains(t, "has files")
}
func TestStatusProject_ShowsSourceAndTargets(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
projectRoot := sb.SetupProjectDir("claude")
result := sb.RunCLIInDir(projectRoot, "status", "-p")
result.AssertSuccess(t)
result.AssertOutputContains(t, "Source")
result.AssertOutputContains(t, "Targets")
}
func TestStatusProject_TrackedRepoGitStatusError_ShowsUnknown(t *testing.T) {
sb := testutil.NewSandbox(t)
defer sb.Cleanup()
projectRoot := sb.SetupProjectDir("claude")
makeTrackedRepoWithBrokenStatus(t, filepath.Join(projectRoot, ".skillshare", "skills"), "_broken-repo")
result := sb.RunCLIInDir(projectRoot, "status", "-p")
result.AssertSuccess(t)
result.AssertAnyOutputContains(t, "_broken-repo: failed to check git status")
}