@@ -431,24 +431,18 @@ func Test_Apps_Link(t *testing.T) {
431431 CmdArgs : []string {},
432432 ExpectedError : slackerror .New (slackerror .ErrAppNotFound ),
433433 },
434- "accepting manifest source prompt should save information about the provided deployed app " : {
434+ "links app when manifest source is local " : {
435435 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
436436 cm .Auth .On ("Auths" , mock .Anything ).Return ([]types.SlackAuth {
437437 mockLinkSlackAuth2 ,
438438 mockLinkSlackAuth1 ,
439439 }, nil )
440440 cm .AddDefaultMocks ()
441441 setupAppLinkCommandMocks (t , ctx , cm , cf )
442- // Set manifest source to project to trigger confirmation prompt
442+ // Set manifest source to local
443443 if err := config .SetManifestSource (ctx , cm .Fs , cm .Os , config .ManifestSourceLocal ); err != nil {
444444 require .FailNow (t , fmt .Sprintf ("Failed to set the manifest source in the memory-based file system: %s" , err ))
445445 }
446- // Accept manifest source confirmation prompt
447- cm .IO .On ("ConfirmPrompt" ,
448- mock .Anything ,
449- LinkAppManifestSourceConfirmPromptText ,
450- mock .Anything ,
451- ).Return (true , nil )
452446 cm .IO .On ("SelectPrompt" ,
453447 mock .Anything ,
454448 "Select the existing app team" ,
@@ -496,49 +490,13 @@ func Test_Apps_Link(t *testing.T) {
496490 )
497491 require .NoError (t , err )
498492 assert .Equal (t , expectedApp , actualApp )
499- // Assert manifest confirmation prompt accepted
500- cm .IO .AssertCalled (t , "ConfirmPrompt" ,
501- mock .Anything ,
502- LinkAppManifestSourceConfirmPromptText ,
503- mock .Anything ,
504- )
493+ // Assert manifest source info is displayed
494+ output := cm .GetCombinedOutput ()
495+ assert .Contains (t , output , "App Manifest" )
496+ assert .Contains (t , output , `"project" (local)` )
505497 },
506498 },
507- "declining manifest source prompt should not link app" : {
508- Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
509- cm .AddDefaultMocks ()
510- setupAppLinkCommandMocks (t , ctx , cm , cf )
511- // Set manifest source to project to trigger confirmation prompt
512- if err := config .SetManifestSource (ctx , cm .Fs , cm .Os , config .ManifestSourceLocal ); err != nil {
513- require .FailNow (t , fmt .Sprintf ("Failed to set the manifest source in the memory-based file system: %s" , err ))
514- }
515- // Decline manifest source confirmation prompt
516- cm .IO .On ("ConfirmPrompt" ,
517- mock .Anything ,
518- LinkAppManifestSourceConfirmPromptText ,
519- mock .Anything ,
520- ).Return (false , nil )
521- },
522- CmdArgs : []string {},
523- ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
524- // Assert manifest confirmation prompt accepted
525- cm .IO .AssertCalled (t , "ConfirmPrompt" ,
526- mock .Anything ,
527- LinkAppManifestSourceConfirmPromptText ,
528- mock .Anything ,
529- )
530-
531- // Assert no apps saved
532- apps , _ , err := cm .AppClient .GetDeployedAll (ctx )
533- require .NoError (t , err )
534- require .Len (t , apps , 0 )
535-
536- apps , err = cm .AppClient .GetLocalAll (ctx )
537- require .NoError (t , err )
538- require .Len (t , apps , 0 )
539- },
540- },
541- "manifest source prompt should not display for Run-on-Slack apps with local manifest source" : {
499+ "displays manifest info for Run-on-Slack apps with local manifest source" : {
542500 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
543501 cm .Auth .On ("Auths" , mock .Anything ).Return ([]types.SlackAuth {
544502 mockLinkSlackAuth1 ,
@@ -607,15 +565,13 @@ func Test_Apps_Link(t *testing.T) {
607565 )
608566 require .NoError (t , err )
609567 assert .Equal (t , expectedApp , actualApp )
610- // Assert manifest confirmation prompt was not displayed
611- cm .IO .AssertNotCalled (t , "ConfirmPrompt" ,
612- mock .Anything ,
613- LinkAppManifestSourceConfirmPromptText ,
614- mock .Anything ,
615- )
568+ // Assert manifest source info is displayed
569+ output := cm .GetCombinedOutput ()
570+ assert .Contains (t , output , "App Manifest" )
571+ assert .Contains (t , output , `"project" (local)` )
616572 },
617573 },
618- "manifest source prompt should display for GBP apps with local manifest source" : {
574+ "displays manifest info for GBP apps with local manifest source" : {
619575 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
620576 cm .Auth .On ("Auths" , mock .Anything ).Return ([]types.SlackAuth {
621577 mockLinkSlackAuth1 ,
@@ -627,15 +583,10 @@ func Test_Apps_Link(t *testing.T) {
627583 if err := config .SetManifestSource (ctx , cm .Fs , cm .Os , config .ManifestSourceLocal ); err != nil {
628584 require .FailNow (t , fmt .Sprintf ("Failed to set the manifest source in the memory-based file system: %s" , err ))
629585 }
630- // Mock manifest for Run-on-Slack app
586+ // Mock manifest for GBP app
631587 manifestMock := & app.ManifestMockObject {}
632588 manifestMock .On ("GetManifestLocal" , mock .Anything , mock .Anything , mock .Anything ).Return (types.SlackYaml {}, nil )
633589 cf .AppClient ().Manifest = manifestMock
634- cm .IO .On ("ConfirmPrompt" ,
635- mock .Anything ,
636- LinkAppManifestSourceConfirmPromptText ,
637- mock .Anything ,
638- ).Return (true , nil )
639590 cm .IO .On ("SelectPrompt" ,
640591 mock .Anything ,
641592 "Select the existing app team" ,
@@ -683,12 +634,10 @@ func Test_Apps_Link(t *testing.T) {
683634 )
684635 require .NoError (t , err )
685636 assert .Equal (t , expectedApp , actualApp )
686- // Assert manifest confirmation prompt was displayed
687- cm .IO .AssertCalled (t , "ConfirmPrompt" ,
688- mock .Anything ,
689- LinkAppManifestSourceConfirmPromptText ,
690- mock .Anything ,
691- )
637+ // Assert manifest source info is displayed
638+ output := cm .GetCombinedOutput ()
639+ assert .Contains (t , output , "App Manifest" )
640+ assert .Contains (t , output , `"project" (local)` )
692641 },
693642 },
694643 }, func (clients * shared.ClientFactory ) * cobra.Command {
0 commit comments