We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f57be2f commit f498dc2Copy full SHA for f498dc2
2 files changed
internal/icon/icon.go
@@ -20,10 +20,7 @@ import (
20
"github.com/spf13/afero"
21
)
22
23
-func ResolveIconPath(fs afero.Fs, manifestIcon string) string {
24
- if manifestIcon != "" {
25
- return manifestIcon
26
- }
+func ResolveIconPath(fs afero.Fs) string {
27
supportedExtensions := []string{".png", ".jpg", ".jpeg", ".gif"}
28
for _, dir := range []string{"assets", "."} {
29
for _, ext := range supportedExtensions {
internal/icon/icon_test.go
@@ -24,19 +24,9 @@ import (
func Test_ResolveIconPath(t *testing.T) {
tests := map[string]struct {
- manifestIcon string
- files []string
- expected string
+ files []string
+ expected string
30
}{
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
37
- files: []string{"assets/icon.png", "icon.png"},
38
39
40
"assets/icon.png found": {
41
files: []string{"assets/icon.png"},
42
expected: "assets/icon.png",
@@ -84,7 +74,7 @@ func Test_ResolveIconPath(t *testing.T) {
84
74
for _, f := range tc.files {
85
75
require.NoError(t, afero.WriteFile(fs, f, []byte("img"), 0o644))
86
76
}
87
- result := ResolveIconPath(fs, tc.manifestIcon)
77
+ result := ResolveIconPath(fs)
88
78
assert.Equal(t, tc.expected, result)
89
79
})
90
80
0 commit comments