@@ -107,6 +107,94 @@ func TestCreateCommand(t *testing.T) {
107107 createClientMock .AssertCalled (t , "Create" , mock .Anything , mock .Anything , mock .Anything , expected )
108108 },
109109 },
110+ "creates an agent app using agent argument shortcut" : {
111+ CmdArgs : []string {"agent" },
112+ Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
113+ // Should skip category prompt and go directly to language selection
114+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select a language:" , mock .Anything , mock .Anything ).
115+ Return (
116+ iostreams.SelectPromptResponse {
117+ Prompt : true ,
118+ Index : 0 , // Select Node.js template
119+ },
120+ nil ,
121+ )
122+ createClientMock = new (CreateClientMock )
123+ createClientMock .On ("Create" , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return ("" , nil )
124+ CreateFunc = createClientMock .Create
125+ },
126+ ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
127+ template , err := create .ResolveTemplateURL ("slack-samples/bolt-js-assistant-template" )
128+ require .NoError (t , err )
129+ expected := create.CreateArgs {
130+ Template : template ,
131+ }
132+ createClientMock .AssertCalled (t , "Create" , mock .Anything , mock .Anything , mock .Anything , expected )
133+ // Verify that category prompt was NOT called
134+ cm .IO .AssertNotCalled (t , "SelectPrompt" , mock .Anything , "Select an app:" , mock .Anything , mock .Anything )
135+ },
136+ },
137+ "creates an agent app with app name using agent argument" : {
138+ CmdArgs : []string {"agent" , "my-agent-app" },
139+ Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
140+ // Should skip category prompt and go directly to language selection
141+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select a language:" , mock .Anything , mock .Anything ).
142+ Return (
143+ iostreams.SelectPromptResponse {
144+ Prompt : true ,
145+ Index : 1 , // Select Python template
146+ },
147+ nil ,
148+ )
149+ createClientMock = new (CreateClientMock )
150+ createClientMock .On ("Create" , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return ("" , nil )
151+ CreateFunc = createClientMock .Create
152+ },
153+ ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
154+ template , err := create .ResolveTemplateURL ("slack-samples/bolt-python-assistant-template" )
155+ require .NoError (t , err )
156+ expected := create.CreateArgs {
157+ AppName : "my-agent-app" ,
158+ Template : template ,
159+ }
160+ createClientMock .AssertCalled (t , "Create" , mock .Anything , mock .Anything , mock .Anything , expected )
161+ // Verify that category prompt was NOT called
162+ cm .IO .AssertNotCalled (t , "SelectPrompt" , mock .Anything , "Select an app:" , mock .Anything , mock .Anything )
163+ },
164+ },
165+ "creates an app named agent when template flag is provided" : {
166+ CmdArgs : []string {"agent" , "--template" , "slack-samples/bolt-js-starter-template" },
167+ Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
168+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select an app:" , mock .Anything , mock .Anything ).
169+ Return (
170+ iostreams.SelectPromptResponse {
171+ Flag : true ,
172+ Option : "slack-samples/bolt-js-starter-template" ,
173+ },
174+ nil ,
175+ )
176+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select a language:" , mock .Anything , mock .Anything ).
177+ Return (
178+ iostreams.SelectPromptResponse {
179+ Flag : true ,
180+ Option : "slack-samples/bolt-js-starter-template" ,
181+ },
182+ nil ,
183+ )
184+ createClientMock = new (CreateClientMock )
185+ createClientMock .On ("Create" , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return ("" , nil )
186+ CreateFunc = createClientMock .Create
187+ },
188+ ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
189+ template , err := create .ResolveTemplateURL ("slack-samples/bolt-js-starter-template" )
190+ require .NoError (t , err )
191+ expected := create.CreateArgs {
192+ AppName : "agent" ,
193+ Template : template ,
194+ }
195+ createClientMock .AssertCalled (t , "Create" , mock .Anything , mock .Anything , mock .Anything , expected )
196+ },
197+ },
110198 }, func (cf * shared.ClientFactory ) * cobra.Command {
111199 return NewCreateCommand (cf )
112200 })
0 commit comments