Files
skillshare/internal/config/extras_path_test.go
T
Willie 26529206cb feat(config): add extras source path derivation helpers
Add ExtrasSourceDir, ExtrasSourceDirProject, and ExtrasParentDir to
derive the correct extras directory paths for global and project mode.
2026-03-12 16:45:02 +08:00

31 lines
848 B
Go

package config
import (
"path/filepath"
"testing"
)
func TestExtrasSourceDir(t *testing.T) {
got := ExtrasSourceDir("/home/user/.config/skillshare/skills", "rules")
want := filepath.Join("/home/user/.config/skillshare", "extras", "rules")
if got != want {
t.Errorf("ExtrasSourceDir() = %q, want %q", got, want)
}
}
func TestExtrasSourceDirProject(t *testing.T) {
got := ExtrasSourceDirProject("/projects/myapp", "rules")
want := filepath.Join("/projects/myapp", ".skillshare", "extras", "rules")
if got != want {
t.Errorf("ExtrasSourceDirProject() = %q, want %q", got, want)
}
}
func TestExtrasParentDir(t *testing.T) {
got := ExtrasParentDir("/home/user/.config/skillshare/skills")
want := filepath.Join("/home/user/.config/skillshare", "extras")
if got != want {
t.Errorf("ExtrasParentDir() = %q, want %q", got, want)
}
}