Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/sandbox/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,9 @@ func printSandboxes(cmd *cobra.Command, clients *shared.ClientFactory, token str
if s.Status != "" {
status := style.Secondary(fmt.Sprintf("Status: %s", strings.ToTitle(s.Status)))
if strings.EqualFold(s.Status, "archived") {
clients.IO.PrintInfo(ctx, false, " %s", style.Styler().Red(status))
clients.IO.PrintInfo(ctx, false, " %s", style.Red(status))
} else {
clients.IO.PrintInfo(ctx, false, " %s", style.Styler().Green(status))
clients.IO.PrintInfo(ctx, false, " %s", style.Green(status))
}
}

Expand Down
33 changes: 31 additions & 2 deletions cmd/sandbox/list_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestListCommand(t *testing.T) {
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
},
},
"with sandboxes": {
"with active sandboxes": {
CmdArgs: []string{"--experiment=sandboxes", "--token", "xoxb-test-token"},
Setup: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock, cf *shared.ClientFactory) {
testToken := "xoxb-test-token"
Expand All @@ -73,7 +73,36 @@ func TestListCommand(t *testing.T) {
cm.Config.ExperimentsFlag = []string{string(experiment.Sandboxes)}
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
},
ExpectedStdoutOutputs: []string{"my-sandbox", "T123", "https://my-sandbox.slack.com"},
ExpectedStdoutOutputs: []string{"my-sandbox", "T123", "https://my-sandbox.slack.com", "Status: ACTIVE"},
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
},
},
"with archived sandbox": {
CmdArgs: []string{"--experiment=sandboxes", "--token", "xoxb-test-token"},
Setup: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock, cf *shared.ClientFactory) {
testToken := "xoxb-test-token"
cm.Auth.On("AuthWithToken", mock.Anything, testToken).Return(types.SlackAuth{Token: testToken}, nil)
cm.Auth.On("ResolveAPIHost", mock.Anything, mock.Anything, mock.Anything).Return("https://api.slack.com")
cm.Auth.On("ResolveLogstashHost", mock.Anything, mock.Anything, mock.Anything).Return("https://slackb.com/events/cli")
sandboxes := []types.Sandbox{
{
SandboxTeamID: "T456",
SandboxName: "old-sandbox",
SandboxDomain: "old-sandbox",
Status: "archived",
DateCreated: 1700000000,
DateArchived: 1710000000,
},
}
cm.API.On("ListSandboxes", mock.Anything, testToken, "").Return(sandboxes, nil)
cm.API.On("UsersInfo", mock.Anything, mock.Anything, mock.Anything).Return(&types.UserInfo{Profile: types.UserProfile{}}, nil)

cm.AddDefaultMocks()
cm.Config.ExperimentsFlag = []string{string(experiment.Sandboxes)}
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
},
ExpectedStdoutOutputs: []string{"old-sandbox", "T456", "Status: ARCHIVED"},
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
},
Expand Down
2 changes: 1 addition & 1 deletion internal/style/style.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func Warning(text string) string {
if !isCharmEnabled {
return legacyWarning(text)
}
return render(lipgloss.NewStyle().Foreground(slackGreen).Bold(true), text)
return render(lipgloss.NewStyle().Foreground(slackYellow).Bold(true), text)
}

func Header(text string) string {
Expand Down
Loading