2020-01-12 14:00:56 +01:00
|
|
|
package fs
|
2019-12-17 17:03:14 +01:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestMimeType(t *testing.T) {
|
|
|
|
t.Run("jpg", func(t *testing.T) {
|
2020-01-31 15:29:06 +01:00
|
|
|
filename := Abs("./testdata/test.jpg")
|
2019-12-17 17:03:14 +01:00
|
|
|
mimeType := MimeType(filename)
|
|
|
|
assert.Equal(t, "image/jpeg", mimeType)
|
|
|
|
})
|
|
|
|
t.Run("not existing filename", func(t *testing.T) {
|
2020-01-31 15:29:06 +01:00
|
|
|
filename := Abs("./testdata/xxx.jpg")
|
2019-12-17 17:03:14 +01:00
|
|
|
mimeType := MimeType(filename)
|
|
|
|
assert.Equal(t, "", mimeType)
|
|
|
|
})
|
|
|
|
}
|