@@ -379,6 +379,39 @@ func TestCreateCommand(t *testing.T) {
379379 }))
380380 },
381381 },
382+ "non-TTY without name falls back to generated name" : {
383+ CmdArgs : []string {"--template" , "slack-samples/bolt-js-starter-template" },
384+ Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
385+ // IsTTY defaults to false via AddDefaultMocks, simulating piped output
386+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select an app:" , mock .Anything , mock .Anything ).
387+ Return (
388+ iostreams.SelectPromptResponse {
389+ Flag : true ,
390+ Option : "slack-samples/bolt-js-starter-template" ,
391+ },
392+ nil ,
393+ )
394+ cm .IO .On ("SelectPrompt" , mock .Anything , "Select a language:" , mock .Anything , mock .Anything ).
395+ Return (
396+ iostreams.SelectPromptResponse {
397+ Flag : true ,
398+ Option : "slack-samples/bolt-js-starter-template" ,
399+ },
400+ nil ,
401+ )
402+ createClientMock = new (CreateClientMock )
403+ createClientMock .On ("Create" , mock .Anything , mock .Anything , mock .Anything , mock .Anything ).Return ("" , nil )
404+ CreateFunc = createClientMock .Create
405+ },
406+ ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
407+ // Should NOT prompt for name since not a TTY
408+ cm .IO .AssertNotCalled (t , "InputPrompt" , mock .Anything , "Name your app:" , mock .Anything )
409+ // Should still call Create with a non-empty generated name
410+ createClientMock .AssertCalled (t , "Create" , mock .Anything , mock .Anything , mock .Anything , mock .MatchedBy (func (args create.CreateArgs ) bool {
411+ return args .AppName != ""
412+ }))
413+ },
414+ },
382415 "positional arg skips name prompt" : {
383416 CmdArgs : []string {"my-project" },
384417 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
0 commit comments