Skip to content

Commit 4d5f768

Browse files
srtaalejmwbrooks
andauthored
fix: address lipgloss styling gaps (#391)
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
1 parent ca87f1d commit 4d5f768

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

cmd/sandbox/list.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ func printSandboxes(cmd *cobra.Command, clients *shared.ClientFactory, token str
119119
if s.Status != "" {
120120
status := style.Secondary(fmt.Sprintf("Status: %s", strings.ToTitle(s.Status)))
121121
if strings.EqualFold(s.Status, "archived") {
122-
clients.IO.PrintInfo(ctx, false, " %s", style.Styler().Red(status))
122+
clients.IO.PrintInfo(ctx, false, " %s", style.Red(status))
123123
} else {
124-
clients.IO.PrintInfo(ctx, false, " %s", style.Styler().Green(status))
124+
clients.IO.PrintInfo(ctx, false, " %s", style.Green(status))
125125
}
126126
}
127127

cmd/sandbox/list_test.go

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ func TestListCommand(t *testing.T) {
4949
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
5050
},
5151
},
52-
"with sandboxes": {
52+
"with active sandboxes": {
5353
CmdArgs: []string{"--experiment=sandboxes", "--token", "xoxb-test-token"},
5454
Setup: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock, cf *shared.ClientFactory) {
5555
testToken := "xoxb-test-token"
@@ -73,7 +73,36 @@ func TestListCommand(t *testing.T) {
7373
cm.Config.ExperimentsFlag = []string{string(experiment.Sandboxes)}
7474
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
7575
},
76-
ExpectedStdoutOutputs: []string{"my-sandbox", "T123", "https://my-sandbox.slack.com"},
76+
ExpectedStdoutOutputs: []string{"my-sandbox", "T123", "https://my-sandbox.slack.com", "Status: ACTIVE"},
77+
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
78+
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
79+
},
80+
},
81+
"with archived sandbox": {
82+
CmdArgs: []string{"--experiment=sandboxes", "--token", "xoxb-test-token"},
83+
Setup: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock, cf *shared.ClientFactory) {
84+
testToken := "xoxb-test-token"
85+
cm.Auth.On("AuthWithToken", mock.Anything, testToken).Return(types.SlackAuth{Token: testToken}, nil)
86+
cm.Auth.On("ResolveAPIHost", mock.Anything, mock.Anything, mock.Anything).Return("https://api.slack.com")
87+
cm.Auth.On("ResolveLogstashHost", mock.Anything, mock.Anything, mock.Anything).Return("https://slackb.com/events/cli")
88+
sandboxes := []types.Sandbox{
89+
{
90+
SandboxTeamID: "T456",
91+
SandboxName: "old-sandbox",
92+
SandboxDomain: "old-sandbox",
93+
Status: "archived",
94+
DateCreated: 1700000000,
95+
DateArchived: 1710000000,
96+
},
97+
}
98+
cm.API.On("ListSandboxes", mock.Anything, testToken, "").Return(sandboxes, nil)
99+
cm.API.On("UsersInfo", mock.Anything, mock.Anything, mock.Anything).Return(&types.UserInfo{Profile: types.UserProfile{}}, nil)
100+
101+
cm.AddDefaultMocks()
102+
cm.Config.ExperimentsFlag = []string{string(experiment.Sandboxes)}
103+
cm.Config.LoadExperiments(ctx, cm.IO.PrintDebug)
104+
},
105+
ExpectedStdoutOutputs: []string{"old-sandbox", "T456", "Status: ARCHIVED"},
77106
ExpectedAsserts: func(t *testing.T, ctx context.Context, cm *shared.ClientsMock) {
78107
cm.API.AssertCalled(t, "ListSandboxes", mock.Anything, "xoxb-test-token", "")
79108
},

internal/style/style.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ func Warning(text string) string {
153153
if !isCharmEnabled {
154154
return legacyWarning(text)
155155
}
156-
return render(lipgloss.NewStyle().Foreground(slackGreen).Bold(true), text)
156+
return render(lipgloss.NewStyle().Foreground(slackYellow).Bold(true), text)
157157
}
158158

159159
func Header(text string) string {

0 commit comments

Comments
 (0)