abfea6354c
see https://www.w3.org/TR/css-fonts-3/#font-fetching-requirements Signed-off-by: Michael Mayer <michael@photoprism.app>
25 lines
698 B
Go
25 lines
698 B
Go
package header
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestAllowCORS(t *testing.T) {
|
|
t.Run("CSS", func(t *testing.T) {
|
|
assert.False(t, AllowCORS(""))
|
|
assert.False(t, AllowCORS("."))
|
|
assert.False(t, AllowCORS(" "))
|
|
assert.False(t, AllowCORS(".css"))
|
|
assert.False(t, AllowCORS(" .css"))
|
|
assert.True(t, AllowCORS("a.css"))
|
|
assert.True(t, AllowCORS("static/files/styles.css"))
|
|
assert.True(t, AllowCORS("/static/files/styles.css"))
|
|
assert.True(t, AllowCORS("/static/files/a.css"))
|
|
assert.False(t, AllowCORS("/static/files/styles/.css"))
|
|
assert.False(t, AllowCORS("/.css"))
|
|
assert.False(t, AllowCORS(".css"))
|
|
assert.False(t, AllowCORS("css"))
|
|
})
|
|
}
|