Skip to content

Commit 431cc6b

Browse files
committed
fix tests
1 parent caa01e6 commit 431cc6b

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

cmd/agent_context_test.go

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -143,13 +143,16 @@ func TestExtractFlagGroups_AllAnnotationKeys(t *testing.T) {
143143
}
144144

145145
func TestBuildAgentContext_HiddenCommands(t *testing.T) {
146-
ctx := buildAgentContext(rootCmd)
147-
spam := findAgentCommand(ctx.Commands, "campaigns")
148-
if spam == nil {
149-
t.Fatal("campaigns not found in output (hidden commands should still be included)")
146+
root := &cobra.Command{Use: "root"}
147+
root.AddCommand(&cobra.Command{Use: "secret", Hidden: true})
148+
149+
ctx := buildAgentContext(root)
150+
secret := findAgentCommand(ctx.Commands, "secret")
151+
if secret == nil {
152+
t.Fatal("secret not found in output (hidden commands should still be included)")
150153
}
151-
if !spam.Hidden {
152-
t.Error("campaigns should be hidden=true")
154+
if !secret.Hidden {
155+
t.Error("secret should be hidden=true")
153156
}
154157
}
155158

0 commit comments

Comments
 (0)