photoprism/internal/pwa/icon_test.go
Michael Mayer 826addb4c1 PWA: Create manifest.json in code without using a template #3181
Signed-off-by: Michael Mayer <michael@photoprism.app>
2023-02-10 15:53:01 +01:00

24 lines
718 B
Go

package pwa
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestNewIcons(t *testing.T) {
t.Run("Standard", func(t *testing.T) {
result := NewIcons("https://demo-cdn.photoprism.app/static", "test")
assert.NotEmpty(t, result)
assert.Equal(t, "https://demo-cdn.photoprism.app/static/icons/test/16.png", result[0].Src)
assert.Equal(t, "image/png", result[0].Type)
assert.Equal(t, "16x16", result[0].Sizes)
})
t.Run("Custom", func(t *testing.T) {
result := NewIcons("https://demo-cdn.photoprism.app/static", "/test.png")
assert.NotEmpty(t, result)
assert.Equal(t, "/test.png", result[0].Src)
assert.Equal(t, "image/png", result[0].Type)
assert.Equal(t, "", result[0].Sizes)
})
}