go-devops/cmd/dev/cmd_vm_test.go
Codex 096cb1bab2 fix(go-devops): replace testify with stdlib testing patterns (AX-6)
Removes testify + indirect deps from go.mod/go.sum; rewrites
assert/require calls across cmd/dev/*, cmd/setup/*, devkit/* _test.go
to stdlib t.Fatalf patterns. go vet clean. TestRunTestGen_Good fails
pre-existing (missing cmd/dev/pkg/ env) at dev tip — unrelated to
this PR.

Closes tasks.lthn.sh/view.php?id=754

Co-authored-by: Codex <noreply@openai.com>
Via-codex-lane: Cyclops-754 dispatch
2026-04-24 18:51:16 +01:00

40 lines
897 B
Go

package dev
import (
"testing"
"dappco.re/go/core/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)
}