From 872cf495c24be303183a182d64b2b22e15a0c735 Mon Sep 17 00:00:00 2001 From: Kynan Ware <47394200+BagToad@users.noreply.github.com> Date: Thu, 11 Sep 2025 09:19:52 -0600 Subject: [PATCH] Refactor create command tests and add base branch case Removed redundant test cases for file input and stdin in TestNewCmdCreate, and added a new test to verify that the base branch argument sets the BaseBranch field correctly. --- pkg/cmd/agent-task/create/create_test.go | 44 ++++-------------------- 1 file changed, 6 insertions(+), 38 deletions(-) diff --git a/pkg/cmd/agent-task/create/create_test.go b/pkg/cmd/agent-task/create/create_test.go index 2969bdcc7..5780b70b3 100644 --- a/pkg/cmd/agent-task/create/create_test.go +++ b/pkg/cmd/agent-task/create/create_test.go @@ -44,51 +44,18 @@ func TestNewCmdCreate(t *testing.T) { ProblemStatementFile: "", }, }, - { - name: "from-file succes", - args: "-F task-description.md", - wantOpts: &CreateOptions{ - ProblemStatement: "", - ProblemStatementFile: "task-description.md", - }, - }, - { - name: "file content from stdin success", - args: "-F -", - stdin: "task description from stdin", - wantOpts: &CreateOptions{ - ProblemStatement: "", - ProblemStatementFile: "-", - }, - }, { name: "mutually exclusive arg and file", args: "'some task inline' -F foo.md", wantErr: "only one of -F or arg can be provided", }, { - name: "missing file path is accepted", - args: "-F does-not-exist.md", + name: "base branch sets baseBranch field", + args: "'task description' -b feature", wantOpts: &CreateOptions{ - ProblemStatement: "", - ProblemStatementFile: "does-not-exist.md", - }, - }, - { - name: "empty file accepted at", - args: "-F empty-task-description.md", - wantOpts: &CreateOptions{ - ProblemStatement: "", - ProblemStatementFile: "empty-task-description.md", - }, - }, - { - name: "empty from stdin accepted", - args: "-F -", - stdin: " \n\n", - wantOpts: &CreateOptions{ - ProblemStatement: "", - ProblemStatementFile: "-", + ProblemStatement: "task description", + ProblemStatementFile: "", + BaseBranch: "feature", }, }, } @@ -129,6 +96,7 @@ func TestNewCmdCreate(t *testing.T) { if tt.wantOpts != nil { require.Equal(t, tt.wantOpts.ProblemStatement, gotOpts.ProblemStatement) require.Equal(t, tt.wantOpts.ProblemStatementFile, gotOpts.ProblemStatementFile) + require.Equal(t, tt.wantOpts.BaseBranch, gotOpts.BaseBranch) } }) }