add TestGetMimeType

Signed-off-by: Davor Kapsa <davor.kapsa@gmail.com>
This commit is contained in:
Davor Kapsa 2018-10-03 20:54:11 +02:00 committed by Denys Smirnov
parent f9c6cbabb1
commit 66fda9af16

View File

@ -92,6 +92,24 @@ func (s *EnryTestSuite) TestIsImage() {
} }
} }
func (s *EnryTestSuite) TestGetMimeType() {
tests := []struct {
name string
path string
lang string
expected string
}{
{name: "TestGetMimeType_1", path: "text.txt", lang: "", expected: "text/plain"},
{name: "TestGetMimeType_2", path: "file.go", lang: "Go", expected: "text/x-go"},
{name: "TestGetMimeType_3", path: "image.png", lang: "", expected: "image/png"},
}
for _, test := range tests {
is := GetMimeType(test.path, test.lang)
assert.Equal(s.T(), is, test.expected, fmt.Sprintf("%v: is = %v, expected: %v", test.name, is, test.expected))
}
}
func (s *EnryTestSuite) TestIsConfiguration() { func (s *EnryTestSuite) TestIsConfiguration() {
tests := []struct { tests := []struct {
name string name string