go-devops/cmd/dev/cmd_vm_test.go
Snider c43090e2ca feat(ax-10): bring go-devops to v0.8.0-alpha.1 + CLI test scaffold
- Bump dappco.re/go/* deps to v0.8.0-alpha.1 in go.mod (any forge.lthn.ai/core/* paths migrated to canonical dappco.re/go/* form)
- Update Go source imports across 55 .go files

Co-Authored-By: Athena <athena@lthn.ai>
2026-04-24 23:44:02 +01:00

40 lines
892 B
Go

package dev
import (
"testing"
"dappco.re/go/cli/pkg/cli"
)
func TestAddVMStatusCommand_Good(t *testing.T) {
root := &cli.Command{Use: "core"}
AddDevCommands(root)
statusCmd, _, err := root.Find([]string{"dev", "status"})
mustNoError(t, err)
if statusCmd == nil {
t.Fatal("expected non-nil status command")
}
mustEqual(t, "status", statusCmd.Use)
mustContainsAlias(t, statusCmd.Aliases, "vm-status")
aliasCmd, _, err := root.Find([]string{"dev", "vm-status"})
mustNoError(t, err)
if aliasCmd == nil {
t.Fatal("expected non-nil alias command")
}
if statusCmd != aliasCmd {
t.Fatalf("want alias to be same command, got %v vs %v", statusCmd, aliasCmd)
}
}
func mustContainsAlias(t *testing.T, haystack []string, needle string) {
t.Helper()
for _, s := range haystack {
if s == needle {
return
}
}
t.Fatalf("expected %v to contain %q", haystack, needle)
}