-
Notifications
You must be signed in to change notification settings - Fork 37
feat(create): cleanup app creation outputs when slack create -app passed
#598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a0f86d7
7b615b7
ecac2c5
bfde928
4b5a8c8
925c458
3a50f11
8374023
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -573,50 +573,28 @@ func Test_Apps_Link(t *testing.T) { | |
|
|
||
| func Test_Apps_LinkAppHeaderSection(t *testing.T) { | ||
| tests := map[string]struct { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🏗️ quibble: Keeping table tests structured - even if one case - instead of a flattened single case might encourage additional cases |
||
| shouldConfirm bool | ||
| expectedOutputs []string | ||
| unexpectedOutputs []string | ||
| expectedOutputs []string | ||
| }{ | ||
| "When shouldConfirm is false": { | ||
| shouldConfirm: false, | ||
| "Displays app link header with base information": { | ||
| expectedOutputs: []string{ | ||
| "Add an existing app from app settings", | ||
| "Find your existing apps at: https://api.slack.com/apps", | ||
| }, | ||
| unexpectedOutputs: []string{ | ||
| "Manually add apps later with", | ||
| }, | ||
| }, | ||
| "When shouldConfirm is true": { | ||
| shouldConfirm: true, | ||
| expectedOutputs: []string{ | ||
| "Add an existing app from app settings", | ||
| "Find your existing apps at: https://api.slack.com/apps", | ||
| "Manually add apps later with", | ||
| }, | ||
| }, | ||
| } | ||
| for name, tc := range tests { | ||
| t.Run(name, func(t *testing.T) { | ||
| // Create mocks | ||
| ctx := slackcontext.MockContext(t.Context()) | ||
| clientsMock := shared.NewClientsMock() | ||
| clientsMock.AddDefaultMocks() | ||
|
|
||
| // Create clients that is mocked for testing | ||
| clients := shared.NewClientFactory(clientsMock.MockClientFactory()) | ||
|
|
||
| // Run the test | ||
| LinkAppHeaderSection(ctx, clients, tc.shouldConfirm) | ||
| LinkAppHeaderSection(ctx, clients) | ||
|
|
||
| // Assertions | ||
| output := clientsMock.GetCombinedOutput() | ||
| for _, expectedOutput := range tc.expectedOutputs { | ||
| require.Contains(t, output, expectedOutput) | ||
| } | ||
| for _, unexpectedOutput := range tc.unexpectedOutputs { | ||
| require.NotContains(t, output, unexpectedOutput) | ||
| } | ||
| }) | ||
| } | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -229,9 +229,15 @@ func runCreateCommand(clients *shared.ClientFactory, cmd *cobra.Command, args [] | |
| defer func() { | ||
| _ = os.Chdir(originalDir) | ||
| }() | ||
| if err := app.LinkExistingApp(ctx, clients, &types.App{}, false); err != nil { | ||
| linkedApp := &types.App{} | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔭 note: IIRC adjacent PR has discussion about returning instead of providing an |
||
| if err := app.LinkExistingApp(ctx, clients, linkedApp); err != nil { | ||
| return err | ||
| } | ||
| clients.IO.PrintInfo(ctx, false, "%s", style.Sectionf(style.TextSection{ | ||
| Emoji: "house", | ||
| Text: "App", | ||
| Secondary: app.FormatListSuccess([]types.App{*linkedApp}), | ||
| })) | ||
|
Comment on lines
+236
to
+240
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🌟 praise: Inlining this output within |
||
| } | ||
|
|
||
| printCreateSuccess(ctx, clients, appDirPath) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.