-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsts_test.go
More file actions
74 lines (62 loc) · 1.79 KB
/
Copy pathsts_test.go
File metadata and controls
74 lines (62 loc) · 1.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
package cmd
import (
"testing"
"github.com/stackvista/stackstate-cli/internal/di"
"github.com/stretchr/testify/assert"
)
func TestSTSCommand(t *testing.T) {
cli := di.NewMockDeps(t)
cmd := STSCommand(&cli.Deps)
assert.Equal(t, "sts", cmd.Use)
assert.Equal(t, "StackState: topology-powered observability", cmd.Short)
assert.Equal(t, "StackState: topology-powered observability.", cmd.Long)
assert.Contains(t, cmd.UsageTemplate(), "For more information about this CLI visit https://l.stackstate.com/cli")
}
func TestSTSCommandContainsExpectedSubcommands(t *testing.T) {
cli := di.NewMockDeps(t)
cmd := STSCommand(&cli.Deps)
expectedCommands := []string{
"context",
"version",
"script",
"settings",
"stackpack",
"monitor",
"service-token",
"health",
"license",
"graph",
"rbac",
"topic",
"topology-sync",
"agent",
"user-session",
"dashboard",
}
// Verify expected commands are present
for _, expectedCmd := range expectedCommands {
found := false
for _, subCmd := range cmd.Commands() {
if subCmd.Use == expectedCmd {
found = true
break
}
}
assert.True(t, found, "Expected command '%s' not found", expectedCmd)
}
}
func TestSTSCommandStructure(t *testing.T) {
cli := di.NewMockDeps(t)
cmd := STSCommand(&cli.Deps)
assert.Len(t, cmd.Commands(), 16, "Expected 16 subcommands")
}
func TestSTSCommandUsageTemplate(t *testing.T) {
cli := di.NewMockDeps(t)
cmd := STSCommand(&cli.Deps)
usageTemplate := cmd.UsageTemplate()
assert.Contains(t, usageTemplate, "For more information about this CLI visit https://l.stackstate.com/cli")
// Verify it contains the standard usage template plus our addition
assert.Contains(t, usageTemplate, "Usage:")
assert.Contains(t, usageTemplate, "Available Commands:")
assert.Contains(t, usageTemplate, "Flags:")
}