Skip to content

Commit f498dc2

Browse files
committed
refactor: remove manifestIcon param from icon.ResolveIconPath
Manifest icon handling now lives in the resolveIconPath wrapper in install.go, so icon.ResolveIconPath only does file discovery.
1 parent f57be2f commit f498dc2

2 files changed

Lines changed: 4 additions & 17 deletions

File tree

internal/icon/icon.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,7 @@ import (
2020
"github.com/spf13/afero"
2121
)
2222

23-
func ResolveIconPath(fs afero.Fs, manifestIcon string) string {
24-
if manifestIcon != "" {
25-
return manifestIcon
26-
}
23+
func ResolveIconPath(fs afero.Fs) string {
2724
supportedExtensions := []string{".png", ".jpg", ".jpeg", ".gif"}
2825
for _, dir := range []string{"assets", "."} {
2926
for _, ext := range supportedExtensions {

internal/icon/icon_test.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,9 @@ import (
2424

2525
func Test_ResolveIconPath(t *testing.T) {
2626
tests := map[string]struct {
27-
manifestIcon string
28-
files []string
29-
expected string
27+
files []string
28+
expected string
3029
}{
31-
"manifest icon set returns it directly": {
32-
manifestIcon: "custom/my-icon.png",
33-
expected: "custom/my-icon.png",
34-
},
35-
"manifest icon preferred over magic icon files": {
36-
manifestIcon: "custom/my-icon.png",
37-
files: []string{"assets/icon.png", "icon.png"},
38-
expected: "custom/my-icon.png",
39-
},
4030
"assets/icon.png found": {
4131
files: []string{"assets/icon.png"},
4232
expected: "assets/icon.png",
@@ -84,7 +74,7 @@ func Test_ResolveIconPath(t *testing.T) {
8474
for _, f := range tc.files {
8575
require.NoError(t, afero.WriteFile(fs, f, []byte("img"), 0o644))
8676
}
87-
result := ResolveIconPath(fs, tc.manifestIcon)
77+
result := ResolveIconPath(fs)
8878
assert.Equal(t, tc.expected, result)
8979
})
9080
}

0 commit comments

Comments
 (0)