@@ -17,20 +17,15 @@ package manifest
1717import (
1818 "context"
1919 "encoding/json"
20- "fmt"
21- "path/filepath"
22- "strings"
2320 "testing"
2421
2522 "github.com/slackapi/slack-cli/internal/app"
2623 "github.com/slackapi/slack-cli/internal/config"
27- "github.com/slackapi/slack-cli/internal/experiment"
2824 "github.com/slackapi/slack-cli/internal/hooks"
2925 "github.com/slackapi/slack-cli/internal/prompts"
3026 "github.com/slackapi/slack-cli/internal/shared"
3127 "github.com/slackapi/slack-cli/internal/shared/types"
3228 "github.com/slackapi/slack-cli/internal/slackerror"
33- "github.com/slackapi/slack-cli/internal/style"
3429 "github.com/slackapi/slack-cli/test/testutil"
3530 "github.com/spf13/cobra"
3631 "github.com/stretchr/testify/assert"
@@ -113,7 +108,7 @@ func TestInfoCommand(t *testing.T) {
113108 assert .Equal (t , string (manifest )+ "\n " , cm .GetStdoutOutput ())
114109 },
115110 },
116- "gathers manifest.source from project configurations with the bolt experiment " : {
111+ "gathers manifest.source local from project configurations" : {
117112 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
118113 appSelectMock := prompts .NewAppSelectMock ()
119114 appSelectPromptFunc = appSelectMock .AppSelectPrompt
@@ -133,8 +128,6 @@ func TestInfoCommand(t *testing.T) {
133128 },
134129 }, nil )
135130 cf .AppClient ().Manifest = manifestMock
136- cm .Config .ExperimentsFlag = append (cm .Config .ExperimentsFlag , string (experiment .BoltFrameworks ))
137- cm .Config .LoadExperiments (ctx , cm .IO .PrintDebug )
138131 mockProjectConfig := config .NewProjectConfigMock ()
139132 mockProjectConfig .On ("GetManifestSource" , mock .Anything ).Return (config .ManifestSourceLocal , nil )
140133 cm .Config .ProjectConfig = mockProjectConfig
@@ -150,24 +143,40 @@ func TestInfoCommand(t *testing.T) {
150143 assert .Equal (t , string (manifest )+ "\n " , cm .GetStdoutOutput ())
151144 },
152145 },
153- "errors if project manifest source is remote with the bolt experiment" : {
154- ExpectedError : slackerror .New (slackerror .ErrInvalidManifestSource ).
155- WithMessage (`Cannot get manifest info from the "%s" source` , config .ManifestSourceRemote ).
156- WithRemediation ("%s" , strings .Join ([]string {
157- fmt .Sprintf ("Find the current manifest on app settings: %s" , style .LinkText ("https://api.slack.com/apps" )),
158- fmt .Sprintf ("Set \" manifest.source\" to \" %s\" in \" %s\" to continue" , config .ManifestSourceLocal , filepath .Join (".slack" , "config.json" )),
159- fmt .Sprintf ("Read about manifest sourcing with %s" , style .Commandf ("manifest info --help" , false )),
160- }, "\n " )),
146+ "gathers manifest.source remote from project configurations" : {
161147 Setup : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock , cf * shared.ClientFactory ) {
162148 cf .SDKConfig .WorkingDirectory = "."
163149 cm .IO .AddDefaultMocks ()
164150 cm .Os .AddDefaultMocks ()
165- cm .Config .ExperimentsFlag = append (cm .Config .ExperimentsFlag , string (experiment .BoltFrameworks ))
166- cm .Config .LoadExperiments (ctx , cm .IO .PrintDebug )
167151 mockProjectConfig := config .NewProjectConfigMock ()
168152 mockProjectConfig .On ("GetManifestSource" , mock .Anything ).
169153 Return (config .ManifestSource (config .ManifestSourceRemote ), nil )
170154 cm .Config .ProjectConfig = mockProjectConfig
155+ manifestMock := & app.ManifestMockObject {}
156+ manifestMock .On ("GetManifestRemote" , mock .Anything , mock .Anything , mock .Anything ).Return (types.SlackYaml {
157+ AppManifest : types.AppManifest {
158+ DisplayInformation : types.DisplayInformation {
159+ Name : "app005" ,
160+ },
161+ },
162+ }, nil )
163+ cf .AppClient ().Manifest = manifestMock
164+ appSelectMock := prompts .NewAppSelectMock ()
165+ appSelectPromptFunc = appSelectMock .AppSelectPrompt
166+ appSelectMock .On ("AppSelectPrompt" ).Return (prompts.SelectedApp {
167+ App : types.App {AppID : "A005" },
168+ Auth : types.SlackAuth {Token : "xapp-example-005" },
169+ }, nil )
170+ },
171+ ExpectedAsserts : func (t * testing.T , ctx context.Context , cm * shared.ClientsMock ) {
172+ mockManifest := types.AppManifest {
173+ DisplayInformation : types.DisplayInformation {
174+ Name : "app005" ,
175+ },
176+ }
177+ manifest , err := json .MarshalIndent (mockManifest , "" , " " )
178+ require .NoError (t , err )
179+ assert .Equal (t , string (manifest )+ "\n " , cm .GetStdoutOutput ())
171180 },
172181 },
173182 }, func (clients * shared.ClientFactory ) * cobra.Command {
0 commit comments