photoprism/pkg/fs/mime_test.go
Michael Mayer f8a45b14d9 Backend: Move reusable packages to pkg/
Signed-off-by: Michael Mayer <michael@liquidbytes.net>
2020-01-12 14:00:56 +01:00

20 lines
449 B
Go

package fs
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestMimeType(t *testing.T) {
t.Run("jpg", func(t *testing.T) {
filename := ExpandFilename("./testdata/test.jpg")
mimeType := MimeType(filename)
assert.Equal(t, "image/jpeg", mimeType)
})
t.Run("not existing filename", func(t *testing.T) {
filename := ExpandFilename("./testdata/xxx.jpg")
mimeType := MimeType(filename)
assert.Equal(t, "", mimeType)
})
}