email-mcp/internal/cli/app_test.go
2026-04-10 09:40:23 +02:00

39 lines
809 B
Go

package cli
import (
"strings"
"testing"
)
func TestAppRunRejectsUnknownCommand(t *testing.T) {
app := NewApp()
err := app.Run([]string{"unknown"})
if err == nil {
t.Fatal("expected error for unknown command")
}
}
func TestAppRunShowsUsageWhenNoArgsProvided(t *testing.T) {
app := NewApp()
err := app.Run(nil)
if err == nil {
t.Fatal("expected error for missing command")
}
if !strings.Contains(err.Error(), "usage:") {
t.Fatalf("expected usage text in error, got %q", err.Error())
}
}
func TestAppRunAcceptsSetupAndMcp(t *testing.T) {
app := NewApp()
for _, command := range []string{"setup", "mcp"} {
t.Run(command, func(t *testing.T) {
if err := app.Run([]string{command}); err != nil {
t.Fatalf("expected %q to be accepted, got error: %v", command, err)
}
})
}
}