Files
skillshare/internal/install/extension_install_test.go
T
Willie fcbfd39be2 refactor(extensions): describe and rename built-ins by output
md2codex / md2gemini named the *input* (markdown) and read poorly. Rename
the bundled extensions after what they produce: codex-agents and
gemini-commands. Turn the BuiltinExtensions catalog into structs carrying
a human-readable description so the dashboard can explain each one before
install, and propagate the new names across tests and docs.
2026-05-30 19:23:12 +08:00

28 lines
834 B
Go

package install
import "testing"
func TestIsBuiltinExtension(t *testing.T) {
for _, b := range BuiltinExtensions {
if !IsBuiltinExtension(b.Name) {
t.Errorf("%q should be a built-in extension", b.Name)
}
if b.Description == "" {
t.Errorf("built-in %q must have a catalog description", b.Name)
}
}
for _, bad := range []string{"", "../evil", "codex-agents/..", "unknown"} {
if IsBuiltinExtension(bad) {
t.Errorf("%q must not be reported as built-in", bad)
}
}
}
// InstallBuiltinExtension must reject unknown/traversal names before any
// network access, so the whitelist guards the download path.
func TestInstallBuiltinExtension_RejectsUnknown(t *testing.T) {
if err := InstallBuiltinExtension("../../etc", t.TempDir()); err == nil {
t.Fatal("expected error for unknown/traversal extension name")
}
}