Files
skillshare/tests/integration/status_project_test.go
T
Willie 403aafb254 feat: unify project target names with global names, add aliases for backward compat
Project targets now use the same short names as global targets (e.g.,
"claude" instead of "claude-code"). Old project_name values are preserved
as aliases so existing configs continue to work.

- Add Aliases field to targetSpec (deprecated, remove once safe)
- Update 11 targets in targets.yaml: project_name = global_name
- LookupProjectTarget falls back to alias lookup
- Fix 3 callers that bypassed LookupProjectTarget
- Extend MatchesTargetName and KnownTargetNames with alias support
- Add TestLookupProjectTarget_Alias
- Update all integration tests, docs, CLI help, and FAQ
2026-02-16 00:08:59 +08:00

48 lines
1.3 KiB
Go

//go:build !online
package integration
import (
"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")
}