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
2 changes: 1 addition & 1 deletion internal/update/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func (u *UpdateNotification) isCI() bool {

// isIgnoredCommand returns true when the process is in the list of commands.
func (u *UpdateNotification) isIgnoredCommand() bool {
ignoredCommands := []string{"version"}
ignoredCommands := []string{"_fingerprint", "version"}
osStr := os.Args[0:]
if len(osStr) < 2 {
return false
Expand Down
37 changes: 37 additions & 0 deletions internal/update/update_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package update

import (
"context"
"os"
"testing"

"github.com/slackapi/slack-cli/internal/config"
Expand Down Expand Up @@ -109,3 +110,39 @@ func Test_Update_HasUpdate(t *testing.T) {
})
}
}

func Test_Update_isIgnoredCommand(t *testing.T) {
for name, tt := range map[string]struct {
command string
expected bool
}{
"No command": {
command: "",
expected: false,
},
"fingerprint command": {
command: "_fingerprint",
expected: true,
},
"version command": {
command: "version",
expected: true,
},
"auth command": {
command: "auth",
expected: false,
},
} {
t.Run(name, func(t *testing.T) {
if tt.command != "" {
os.Args = []string{"placeholder", tt.command}
} else {
os.Args = []string{"placeholder"}
}
// Test
updateNotification := &UpdateNotification{}
actual := updateNotification.isIgnoredCommand()
require.Equal(t, tt.expected, actual)
})
}
}
Loading